| Index: chrome/test/remoting/me2me_browsertest.cc
|
| diff --git a/chrome/test/remoting/me2me_browsertest.cc b/chrome/test/remoting/me2me_browsertest.cc
|
| index 541dbed0f6bf7be480e8638daef78261674766a2..8c7e98cdb08e67aba7cc8bdefc516b67d9779026 100644
|
| --- a/chrome/test/remoting/me2me_browsertest.cc
|
| +++ b/chrome/test/remoting/me2me_browsertest.cc
|
| @@ -4,18 +4,21 @@
|
|
|
| #include "base/files/file_path.h"
|
| #include "base/files/file_util.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"
|
|
|
| namespace remoting {
|
|
|
| class Me2MeBrowserTest : public RemoteDesktopBrowserTest {
|
| protected:
|
| - void TestKeyboardInput();
|
| - void TestMouseInput();
|
| + void TestKeypressInput(ui::KeyboardCode, const char*);
|
| + void TestMouseInput(blink::WebMouseEvent::Button);
|
|
|
| void ConnectPinlessAndCleanupPairings(bool cleanup_all);
|
| bool IsPairingSpinnerHidden();
|
| + void SetupForRemoteHostTest();
|
| };
|
|
|
| IN_PROC_BROWSER_TEST_F(Me2MeBrowserTest,
|
| @@ -53,6 +56,77 @@ 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,
|
| + MANUAL_Me2Me_Remote_Host_Mouseclick) {
|
| + SetupForRemoteHostTest();
|
| +
|
| + TestMouseInput(blink::WebMouseEvent::ButtonLeft);
|
| + TestMouseInput(blink::WebMouseEvent::ButtonMiddle);
|
| + TestMouseInput(blink::WebMouseEvent::ButtonRight);
|
| + // Dismiss the context menu from the right button press.
|
| + // The button press that cancels the context menu is not captured by the
|
| + // javascript on the page. This ensures that the next run will be clean.
|
| + SimulateMouseLeftClickAt(100, 100);
|
| + DisconnectMe2Me();
|
| + Cleanup();
|
| +}
|
| +
|
| +IN_PROC_BROWSER_TEST_F(Me2MeBrowserTest,
|
| MANUAL_Me2Me_Connect_Pinless) {
|
| SetUpTestForMe2Me();
|
|
|
| @@ -66,40 +140,58 @@ IN_PROC_BROWSER_TEST_F(Me2MeBrowserTest,
|
| Cleanup();
|
| }
|
|
|
| -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);
|
| +void Me2MeBrowserTest::SetupForRemoteHostTest() {
|
| + VerifyInternetAccess();
|
| + OpenClientBrowserPage();
|
| + Install();
|
| + LaunchChromotingApp();
|
|
|
| - // Write some text in the box and press enter
|
| - std::string text = "Abigail";
|
| - SimulateStringInput(text);
|
| - SimulateKeyPressWithCode(
|
| - ui::VKEY_RETURN, "Enter", false, false, false, false);
|
| + // Authorize, Authenticate, and Approve.
|
| + Auth();
|
| + ExpandMe2Me();
|
| + ConnectToRemoteHost(remote_host_name(), 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());
|
| + // Wake up the machine if it's sleeping
|
| + SimulateKeyPressWithCode(ui::VKEY_RETURN, "Enter");
|
| +}
|
|
|
| - // Check that the text we got is correct
|
| - EXPECT_TRUE(ExecuteScriptAndExtractBool(
|
| - client_web_content(),
|
| - "testResult.keypressText == '" + text + "'"));
|
| +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::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::TestMouseInput(
|
| + blink::WebMouseEvent::Button button) {
|
| + remote_test_helper()->ClearLastEvent();
|
| + // Offset the clicks to account for the context menu that appears on a
|
| + // right click;
|
| + int offset = 0;
|
| + switch (button) {
|
| + case blink::WebMouseEvent::ButtonLeft:
|
| + VLOG(1) << "Clicking left mouse button";
|
| + break;
|
| + case blink::WebMouseEvent::ButtonMiddle:
|
| + VLOG(1) << "Clicking middle mouse button";
|
| + break;
|
| + case blink::WebMouseEvent::ButtonRight:
|
| + VLOG(1) << "Clicking right mouse button";
|
| + offset = 100;
|
| + break;
|
| + default:
|
| + LOG(ERROR) << "The indicated button " << button << "is not valid";
|
| + }
|
| + SimulateMouseClickAt(0, button, 100 + offset, 100 + offset);
|
| + Event event;
|
| + remote_test_helper()->GetLastEvent(&event);
|
| + ASSERT_EQ(Action::BUTTONPRESS, event.action);
|
| + ASSERT_EQ(button, event.value);
|
| }
|
|
|
| void Me2MeBrowserTest::ConnectPinlessAndCleanupPairings(bool cleanup_all) {
|
|
|