From ce5234162fa0c534ff9abf3fce3d03f4b01e893e Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Fri, 22 Apr 2016 09:43:44 -0500 Subject: don't prompt when the greeter's not running yet: change greeter's payload from an 'is_active' bool to a three-value state of active, inactive, and unavailable --- tests/integration/usb-manager-test.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tests/integration/usb-manager-test.cpp') diff --git a/tests/integration/usb-manager-test.cpp b/tests/integration/usb-manager-test.cpp index d62756f..7320640 100644 --- a/tests/integration/usb-manager-test.cpp +++ b/tests/integration/usb-manager-test.cpp @@ -206,7 +206,7 @@ TEST_F(UsbManagerFixture, Greeter) auto adbd_server = std::make_shared(*socket_path, std::vector{"PK"+public_key}); // set up a UsbManager to process the request - m_greeter->m_is_active.set(true); + m_greeter->m_state.set(Greeter::State::ACTIVE); auto usb_manager = std::make_shared(*socket_path, *public_keys_path, m_usb_monitor, m_greeter); // add a signal spy to listen to the notification daemon @@ -219,7 +219,7 @@ TEST_F(UsbManagerFixture, Greeter) EXPECT_FALSE(notificationsSpy.wait(2000)); // disable the greeter, the notification should appear - m_greeter->m_is_active.set(false); + m_greeter->m_state.set(Greeter::State::INACTIVE); wait_for_signals(notificationsSpy, 1); EXPECT_EQ("Notify", notificationsSpy.at(0).at(0)); notificationsSpy.clear(); -- cgit v1.2.3 From dfa098f6fcd7203a8975ec891bc1d9f7f9e735ca Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Wed, 27 Apr 2016 13:30:59 +0200 Subject: increase timeout interval on usb manager integration test --- tests/integration/usb-manager-test.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/integration/usb-manager-test.cpp') diff --git a/tests/integration/usb-manager-test.cpp b/tests/integration/usb-manager-test.cpp index 7320640..6532829 100644 --- a/tests/integration/usb-manager-test.cpp +++ b/tests/integration/usb-manager-test.cpp @@ -143,7 +143,7 @@ TEST_F(UsbManagerFixture, Allow) ); // confirm that the AdbdServer got the right response - wait_for([adbd_server](){return !adbd_server->m_responses.empty();}, 2000); + wait_for([adbd_server](){return !adbd_server->m_responses.empty();}, 5000); ASSERT_EQ(1, adbd_server->m_responses.size()); EXPECT_EQ("OK", adbd_server->m_responses.front()); -- cgit v1.2.3 From 403fd0a388e565daf195729d9211ff03c23c93a0 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Tue, 3 May 2016 18:11:00 -0500 Subject: sync UsbManagerFixture::USBDisconnectedDuringPrompt to r40, to expect a 'no' each time there's a usb disconnect --- tests/integration/usb-manager-test.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'tests/integration/usb-manager-test.cpp') 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 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(*socket_path, std::vector{"PK"+public_key}); + const std::vector requests(N_TESTS, "PK"+public_key); + const std::vector expected_responses(N_TESTS, "NO"); + auto adbd_server = std::make_shared(*socket_path, requests); // set up a UsbManager to process the request auto usb_manager = std::make_shared(*socket_path, *public_keys_path, m_usb_monitor, m_greeter); - for (int i=0; i<3; i++) + for (std::remove_const::type i=0; im_responses.size() == N_TESTS;}, 5000)); + EXPECT_EQ(expected_responses, adbd_server->m_responses); } TEST_F(UsbManagerFixture, Greeter) -- cgit v1.2.3