16 #ifndef ALEXA_CLIENT_SDK_ACL_TEST_TRANSPORT_MOCKMESSAGEROUTEROBSERVER_H_ 17 #define ALEXA_CLIENT_SDK_ACL_TEST_TRANSPORT_MOCKMESSAGEROUTEROBSERVER_H_ 34 std::lock_guard<std::mutex> lock(m_mutex);
35 m_notifiedOfReceive =
false;
36 m_notifiedOfStatusChanged =
false;
40 std::lock_guard<std::mutex> lock(m_mutex);
41 return m_notifiedOfStatusChanged;
45 std::lock_guard<std::mutex> lock(m_mutex);
46 return m_notifiedOfReceive;
50 std::lock_guard<std::mutex> lock(m_mutex);
55 std::lock_guard<std::mutex> lock(m_mutex);
60 std::chrono::milliseconds timeout,
63 std::unique_lock<std::mutex> lock(m_mutex);
64 auto result = m_cv.wait_for(lock, timeout, [
this, status, reason]() {
65 return m_notifiedOfStatusChanged && m_status == status && m_reason == reason;
71 std::lock_guard<std::mutex> lock(m_mutex);
76 std::lock_guard<std::mutex> lock(m_mutex);
77 return m_attachmentContextId;
81 void onConnectionStatusChanged(
83 const std::vector<avsCommon::sdkInterfaces::ConnectionStatusObserverInterface::EngineConnectionStatus>&
84 engineConnectionStatuses)
override {
85 if (engineConnectionStatuses.empty()) {
88 std::lock_guard<std::mutex> lock(m_mutex);
89 m_notifiedOfStatusChanged =
true;
91 for (
auto connectionStatus : engineConnectionStatuses) {
93 m_reason = connectionStatus.reason;
100 std::lock_guard<std::mutex> lock(m_mutex);
101 m_notifiedOfReceive =
true;
102 m_attachmentContextId = contextId;
110 std::condition_variable m_cv;
125 bool m_notifiedOfStatusChanged;
128 bool m_notifiedOfReceive;
136 #endif // ALEXA_CLIENT_SDK_ACL_TEST_TRANSPORT_MOCKMESSAGEROUTEROBSERVER_H_ Definition: MockMessageRouterObserver.h:31
bool wasNotifiedOfStatusChange()
Definition: MockMessageRouterObserver.h:39
ChangedReason
Definition: ConnectionStatusObserverInterface.h:50
Definition: MessageRouterObserverInterface.h:31
Definition: AmdMetricWrapperTest.cpp:24
::std::string string
Definition: gtest-port.h:1097
avsCommon::sdkInterfaces::ConnectionStatusObserverInterface::Status getLatestConnectionStatus()
Definition: MockMessageRouterObserver.h:49
void reset()
Definition: MockMessageRouterObserver.h:33
std::string getLatestMessage()
Definition: MockMessageRouterObserver.h:70
std::string getAttachmentContextId()
Definition: MockMessageRouterObserver.h:75
bool wasNotifiedOfReceive()
Definition: MockMessageRouterObserver.h:44
Whether or not curl logs should be emitted.
Definition: AVSConnectionManager.h:36
avsCommon::sdkInterfaces::ConnectionStatusObserverInterface::ChangedReason getLatestConnectionChangedReason()
Definition: MockMessageRouterObserver.h:54
bool waitForStatusChange(std::chrono::milliseconds timeout, avsCommon::sdkInterfaces::ConnectionStatusObserverInterface::Status status, avsCommon::sdkInterfaces::ConnectionStatusObserverInterface::ChangedReason reason)
Definition: MockMessageRouterObserver.h:59
tuple message
Definition: gtest_output_test.py:331
Status
Definition: ConnectionStatusObserverInterface.h:36
static const int ENGINE_TYPE_ALEXA_VOICE_SERVICES
Definition: ConnectionStatusObserverInterface.h:26