aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2016-05-03 18:11:00 -0500
committerCharles Kerr <charles.kerr@canonical.com>2016-05-03 18:11:00 -0500
commit403fd0a388e565daf195729d9211ff03c23c93a0 (patch)
tree504ff690959db75bd2bfc399dbb80576279e246a
parentc66c33c4c1c70b197941f8c486196f3a56abd0e3 (diff)
downloadayatana-indicator-display-403fd0a388e565daf195729d9211ff03c23c93a0.tar.gz
ayatana-indicator-display-403fd0a388e565daf195729d9211ff03c23c93a0.tar.bz2
ayatana-indicator-display-403fd0a388e565daf195729d9211ff03c23c93a0.zip
sync UsbManagerFixture::USBDisconnectedDuringPrompt to r40, to expect a 'no' each time there's a usb disconnect
-rw-r--r--tests/integration/usb-manager-test.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/tests/integration/usb-manager-test.cpp b/tests/integration/usb-manager-test.cpp
index 6532829..805ba6e 100644
--- a/tests/integration/usb-manager-test.cpp
+++ b/tests/integration/usb-manager-test.cpp
@@ -163,13 +163,16 @@ TEST_F(UsbManagerFixture, USBDisconnectedDuringPrompt)
const std::shared_ptr<std::string> public_keys_path {new std::string{*m_tmpdir+"/adb_keys"}, file_deleter};
// start a mock AdbdServer ready to submit a request
+ const size_t N_TESTS {3};
const std::string public_key {"public_key"};
- auto adbd_server = std::make_shared<GAdbdServer>(*socket_path, std::vector<std::string>{"PK"+public_key});
+ const std::vector<std::string> requests(N_TESTS, "PK"+public_key);
+ const std::vector<std::string> expected_responses(N_TESTS, "NO");
+ auto adbd_server = std::make_shared<GAdbdServer>(*socket_path, requests);
// set up a UsbManager to process the request
auto usb_manager = std::make_shared<UsbManager>(*socket_path, *public_keys_path, m_usb_monitor, m_greeter);
- for (int i=0; i<3; i++)
+ for (std::remove_const<decltype(N_TESTS)>::type i=0; i<N_TESTS; ++i)
{
// add a signal spy to listen to the notification daemon
QSignalSpy notificationsSpy(
@@ -194,6 +197,9 @@ TEST_F(UsbManagerFixture, USBDisconnectedDuringPrompt)
EXPECT_EQ("CloseNotification", notificationsSpy.at(0).at(0));
notificationsSpy.clear();
}
+
+ EXPECT_TRUE(wait_for([adbd_server, N_TESTS](){return adbd_server->m_responses.size() == N_TESTS;}, 5000));
+ EXPECT_EQ(expected_responses, adbd_server->m_responses);
}
TEST_F(UsbManagerFixture, Greeter)