Chromium Code Reviews| Index: chrome/test/remoting/me2me_browsertest.cc |
| diff --git a/chrome/test/remoting/me2me_browsertest.cc b/chrome/test/remoting/me2me_browsertest.cc |
| index 72d577ec20c692d1e414a1648b225c2933f2c2f0..0b400628fcab3efa4484844db4b6ee9341b8e50f 100644 |
| --- a/chrome/test/remoting/me2me_browsertest.cc |
| +++ b/chrome/test/remoting/me2me_browsertest.cc |
| @@ -5,7 +5,9 @@ |
| #include "base/files/file_path.h" |
| #include "base/files/file_util.h" |
| #include "chrome/browser/ui/browser_window.h" |
| +#include "chrome/test/remoting/key_code_test_map.h" |
| #include "chrome/test/remoting/remote_desktop_browsertest.h" |
| +#include "chrome/test/remoting/remote_test_helper.h" |
| #include "chrome/test/remoting/waiter.h" |
| #include "extensions/browser/app_window/app_window.h" |
| @@ -13,11 +15,11 @@ namespace remoting { |
| class Me2MeBrowserTest : public RemoteDesktopBrowserTest { |
| protected: |
| - void TestKeyboardInput(); |
| - void TestMouseInput(); |
| + void TestKeypressInput(ui::KeyboardCode, const char*); |
| void ConnectPinlessAndCleanupPairings(bool cleanup_all); |
| bool IsPairingSpinnerHidden(); |
| + void SetupForRemoteHostTest(); |
| void RestoreApp(); |
| void MinimizeApp(); |
| @@ -58,6 +60,62 @@ IN_PROC_BROWSER_TEST_F(Me2MeBrowserTest, |
| } |
| IN_PROC_BROWSER_TEST_F(Me2MeBrowserTest, |
| + MANUAL_Me2Me_Remote_Host_Keypress) { |
| + SetupForRemoteHostTest(); |
| + |
| + // Test all key characters |
| + int length = sizeof(test_key_map)/sizeof(KeyCodeTestMap); |
| + for (int i = 0; i < length; i++) { |
| + KeyCodeTestMap key = test_key_map[i]; |
| + TestKeypressInput(key.vkey_code, key.code); |
| + } |
| + DisconnectMe2Me(); |
| + Cleanup(); |
| +} |
| + |
| +IN_PROC_BROWSER_TEST_F(Me2MeBrowserTest, |
| + MANUAL_Me2Me_Remote_Host_Digitpress) { |
| + SetupForRemoteHostTest(); |
| + |
| + // Test all digit characters |
| + int length = sizeof(test_digit_map)/sizeof(KeyCodeTestMap); |
| + for (int i = 0; i < length; i++) { |
| + KeyCodeTestMap key = test_digit_map[i]; |
| + TestKeypressInput(key.vkey_code, key.code); |
| + } |
| + DisconnectMe2Me(); |
| + Cleanup(); |
| +} |
| + |
| +IN_PROC_BROWSER_TEST_F(Me2MeBrowserTest, |
| + MANUAL_Me2Me_Remote_Host_Specialpress) { |
| + SetupForRemoteHostTest(); |
| + |
| + // Test all special characters |
| + int length = sizeof(test_special_map)/sizeof(KeyCodeTestMap); |
| + for (int i = 0; i < length; i++) { |
| + KeyCodeTestMap key = test_special_map[i]; |
| + TestKeypressInput(key.vkey_code, key.code); |
| + } |
| + DisconnectMe2Me(); |
| + Cleanup(); |
| +} |
| + |
| +IN_PROC_BROWSER_TEST_F(Me2MeBrowserTest, |
| + MANUAL_Me2Me_Remote_Host_Numpadpress) { |
| + SetupForRemoteHostTest(); |
| + |
| + // Test all numpad characters |
| + int length = sizeof(test_numpad_map)/sizeof(KeyCodeTestMap); |
| + for (int i = 0; i < length; i++) { |
| + KeyCodeTestMap key = test_numpad_map[i]; |
| + TestKeypressInput(key.vkey_code, key.code); |
| + } |
| + DisconnectMe2Me(); |
| + Cleanup(); |
| +} |
| + |
| +IN_PROC_BROWSER_TEST_F(Me2MeBrowserTest, |
|
Jamie
2015/01/06 19:31:38
Is it possible to add a test for modifier keys as
Mike Meade
2015/01/08 18:58:42
I have a few special keys in there now. We can det
|
| MANUAL_Me2Me_Connect_Pinless) { |
| SetUpTestForMe2Me(); |
| @@ -96,41 +154,31 @@ IN_PROC_BROWSER_TEST_F(Me2MeBrowserTest, |
| Cleanup(); |
| } |
| +void Me2MeBrowserTest::SetupForRemoteHostTest() { |
| + VerifyInternetAccess(); |
| + OpenClientBrowserPage(); |
| + Install(); |
| + LaunchChromotingApp(false); |
| -void Me2MeBrowserTest::TestKeyboardInput() { |
| - // We will assume here that the browser window is already open on the host |
| - // and in focus. |
| - // Press tab to put focus on the textbox. |
| - SimulateKeyPressWithCode(ui::VKEY_TAB, "Tab", false, false, false, false); |
| - |
| - // Write some text in the box and press enter |
| - std::string text = "Abigail"; |
| - SimulateStringInput(text); |
| - SimulateKeyPressWithCode( |
| - ui::VKEY_RETURN, "Enter", false, false, false, false); |
| - |
| - // Wait until the client tab sets the right variables |
| - ConditionalTimeoutWaiter waiter( |
| - base::TimeDelta::FromSeconds(10), |
| - base::TimeDelta::FromMilliseconds(500), |
| - base::Bind(&RemoteDesktopBrowserTest::IsHostActionComplete, |
| - client_web_content(), |
| - "testResult.keypressSucceeded")); |
| - EXPECT_TRUE(waiter.Wait()); |
| + // Authorize, Authenticate, and Approve. |
| + Auth(); |
| + ExpandMe2Me(); |
| + ConnectToRemoteHost(remote_host_name(), false); |
| - // Check that the text we got is correct |
| - EXPECT_TRUE(ExecuteScriptAndExtractBool( |
| - client_web_content(), |
| - "testResult.keypressText == '" + text + "'")); |
| + // Wake up the machine if it's sleeping |
| + SimulateKeyPressWithCode(ui::VKEY_RETURN, "Enter"); |
| } |
| -void Me2MeBrowserTest::TestMouseInput() { |
| - SimulateMouseLeftClickAt(10, 50); |
| - // TODO: Verify programatically the mouse events are received by the host. |
| - // This will be tricky as it depends on the host OS, window manager, desktop |
| - // layout, and screen resolution. Until then we need to visually verify that |
| - // "Dash Home" is clicked on a Unity window manager. |
| - ASSERT_TRUE(TimeoutWaiter(base::TimeDelta::FromSeconds(5)).Wait()); |
| +void Me2MeBrowserTest::TestKeypressInput( |
| + ui::KeyboardCode keyCode, |
| + const char* code) { |
| + remote_test_helper()->ClearLastEvent(); |
| + VLOG(1) << "Pressing " << code; |
| + SimulateKeyPressWithCode(keyCode, code); |
| + Event event; |
| + remote_test_helper()->GetLastEvent(&event); |
| + ASSERT_EQ(Action::KEYDOWN, event.action); |
| + ASSERT_EQ(keyCode, event.value); |
| } |
| void Me2MeBrowserTest::ConnectPinlessAndCleanupPairings(bool cleanup_all) { |