| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/test/remoting/remote_desktop_browsertest.h" | 5 #include "chrome/test/remoting/remote_desktop_browsertest.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 #include "content/public/browser/native_web_keyboard_event.h" | 23 #include "content/public/browser/native_web_keyboard_event.h" |
| 24 #include "content/public/browser/render_view_host.h" | 24 #include "content/public/browser/render_view_host.h" |
| 25 #include "content/public/test/test_utils.h" | 25 #include "content/public/test/test_utils.h" |
| 26 #include "extensions/browser/extension_registry.h" | 26 #include "extensions/browser/extension_registry.h" |
| 27 #include "extensions/browser/test_extension_registry_observer.h" | 27 #include "extensions/browser/test_extension_registry_observer.h" |
| 28 #include "extensions/common/constants.h" | 28 #include "extensions/common/constants.h" |
| 29 #include "extensions/common/extension.h" | 29 #include "extensions/common/extension.h" |
| 30 #include "extensions/common/extension_set.h" | 30 #include "extensions/common/extension_set.h" |
| 31 #include "extensions/common/switches.h" | 31 #include "extensions/common/switches.h" |
| 32 #include "ui/base/window_open_disposition.h" | 32 #include "ui/base/window_open_disposition.h" |
| 33 #include "ui/events/keycodes/dom/keycode_converter.h" |
| 33 | 34 |
| 34 namespace remoting { | 35 namespace remoting { |
| 35 | 36 |
| 36 RemoteDesktopBrowserTest::RemoteDesktopBrowserTest() | 37 RemoteDesktopBrowserTest::RemoteDesktopBrowserTest() |
| 37 : remote_test_helper_(nullptr), extension_(nullptr) { | 38 : remote_test_helper_(nullptr), extension_(nullptr) { |
| 38 } | 39 } |
| 39 | 40 |
| 40 RemoteDesktopBrowserTest::~RemoteDesktopBrowserTest() {} | 41 RemoteDesktopBrowserTest::~RemoteDesktopBrowserTest() {} |
| 41 | 42 |
| 42 void RemoteDesktopBrowserTest::SetUp() { | 43 void RemoteDesktopBrowserTest::SetUp() { |
| (...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 398 EXPECT_TRUE(HtmlElementVisible("client-reconnect-button")); | 399 EXPECT_TRUE(HtmlElementVisible("client-reconnect-button")); |
| 399 EXPECT_TRUE(HtmlElementVisible("client-finished-me2me-button")); | 400 EXPECT_TRUE(HtmlElementVisible("client-finished-me2me-button")); |
| 400 | 401 |
| 401 ClickOnControl("client-finished-me2me-button"); | 402 ClickOnControl("client-finished-me2me-button"); |
| 402 | 403 |
| 403 EXPECT_FALSE(HtmlElementVisible("client-dialog")); | 404 EXPECT_FALSE(HtmlElementVisible("client-dialog")); |
| 404 } | 405 } |
| 405 | 406 |
| 406 void RemoteDesktopBrowserTest::SimulateKeyPressWithCode( | 407 void RemoteDesktopBrowserTest::SimulateKeyPressWithCode( |
| 407 ui::KeyboardCode keyCode, | 408 ui::KeyboardCode keyCode, |
| 408 const std::string& code) { | 409 const std::string& codeStr) { |
| 409 SimulateKeyPressWithCode(keyCode, code, false, false, false, false); | 410 ui::DomCode code = ui::KeycodeConverter::CodeStringToDomCode(codeStr); |
| 411 SimulateKeyPressWithCode(ui::DomKey(), code, keyCode, false, false, false, |
| 412 false); |
| 410 } | 413 } |
| 411 | 414 |
| 412 void RemoteDesktopBrowserTest::SimulateKeyPressWithCode( | 415 void RemoteDesktopBrowserTest::SimulateKeyPressWithCode( |
| 416 ui::DomKey key, |
| 417 ui::DomCode code, |
| 413 ui::KeyboardCode keyCode, | 418 ui::KeyboardCode keyCode, |
| 414 const std::string& code, | |
| 415 bool control, | 419 bool control, |
| 416 bool shift, | 420 bool shift, |
| 417 bool alt, | 421 bool alt, |
| 418 bool command) { | 422 bool command) { |
| 419 content::SimulateKeyPressWithCode( | 423 content::SimulateKeyPress(active_web_contents(), key, code, keyCode, control, |
| 420 active_web_contents(), | 424 shift, alt, command); |
| 421 keyCode, | |
| 422 code, | |
| 423 control, | |
| 424 shift, | |
| 425 alt, | |
| 426 command); | |
| 427 } | 425 } |
| 428 | 426 |
| 429 void RemoteDesktopBrowserTest::SimulateCharInput(char c) { | 427 void RemoteDesktopBrowserTest::SimulateCharInput(char c) { |
| 430 const char* code; | 428 const char* codeStr; |
| 431 ui::KeyboardCode keyboard_code; | 429 ui::KeyboardCode keyboard_code; |
| 432 bool shift; | 430 bool shift; |
| 433 GetKeyValuesFromChar(c, &code, &keyboard_code, &shift); | 431 GetKeyValuesFromChar(c, &codeStr, &keyboard_code, &shift); |
| 434 ASSERT_TRUE(code != NULL); | 432 ui::DomKey key = ui::DomKey::FromCharacter(c); |
| 435 SimulateKeyPressWithCode(keyboard_code, code, false, shift, false, false); | 433 ASSERT_TRUE(codeStr != NULL); |
| 434 ui::DomCode code = ui::KeycodeConverter::CodeStringToDomCode(codeStr); |
| 435 SimulateKeyPressWithCode(key, code, keyboard_code, false, shift, false, |
| 436 false); |
| 436 } | 437 } |
| 437 | 438 |
| 438 void RemoteDesktopBrowserTest::SimulateStringInput(const std::string& input) { | 439 void RemoteDesktopBrowserTest::SimulateStringInput(const std::string& input) { |
| 439 for (size_t i = 0; i < input.length(); ++i) | 440 for (size_t i = 0; i < input.length(); ++i) |
| 440 SimulateCharInput(input[i]); | 441 SimulateCharInput(input[i]); |
| 441 } | 442 } |
| 442 | 443 |
| 443 void RemoteDesktopBrowserTest::SimulateMouseLeftClickAt(int x, int y) { | 444 void RemoteDesktopBrowserTest::SimulateMouseLeftClickAt(int x, int y) { |
| 444 SimulateMouseClickAt(0, blink::WebMouseEvent::ButtonLeft, x, y); | 445 SimulateMouseClickAt(0, blink::WebMouseEvent::ButtonLeft, x, y); |
| 445 } | 446 } |
| (...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 948 | 949 |
| 949 ConditionalTimeoutWaiter homeWaiter( | 950 ConditionalTimeoutWaiter homeWaiter( |
| 950 base::TimeDelta::FromSeconds(5), | 951 base::TimeDelta::FromSeconds(5), |
| 951 base::TimeDelta::FromMilliseconds(500), | 952 base::TimeDelta::FromMilliseconds(500), |
| 952 base::Bind(&RemoteDesktopBrowserTest::IsAppModeEqualTo, | 953 base::Bind(&RemoteDesktopBrowserTest::IsAppModeEqualTo, |
| 953 this, "remoting.AppMode.HOME")); | 954 this, "remoting.AppMode.HOME")); |
| 954 EXPECT_TRUE(homeWaiter.Wait()); | 955 EXPECT_TRUE(homeWaiter.Wait()); |
| 955 } | 956 } |
| 956 | 957 |
| 957 } // namespace remoting | 958 } // namespace remoting |
| OLD | NEW |