Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(173)

Unified Diff: chrome/test/remoting/me2me_browsertest.cc

Issue 807343002: Adding the first set of remote test cases and associated framework. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..e3904b930eef3c2c97a167d47e4013a7a9614925 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();
+ SimulateKeyPressWithCode(ui::VKEY_SPACE, "Space", false, false, true, false);
Jamie 2014/12/17 03:15:40 None of the other tests do this. Why is it needed
Mike Meade 2014/12/18 18:54:24 Its left over from when I had to wake the machine
+ // 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.
Jamie 2014/12/17 03:15:40 Is this needed? Cleanup uninstalls the app, which
Mike Meade 2014/12/18 18:54:24 This is here for when the tests are run manually,
Jamie 2014/12/18 21:31:44 I still don't understand; whether it's run manuall
Mike Meade 2015/01/05 23:18:58 The context menu is opened in Chrome on a remote h
+ 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 its sleeping
Jamie 2014/12/17 03:15:40 nit: s/its/it's/ I have concerns about this step.
Mike Meade 2014/12/18 18:54:24 Done.
Jamie 2014/12/18 21:31:44 Can you address my concerns about what this means
Mike Meade 2015/01/05 23:18:58 There are 3 things here 1) The server only tracks
Jamie 2015/01/06 19:31:38 Okay, in that case, please remove the reference to
+ 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();
+ LOG(INFO) << "Pressing " << code;
Jamie 2014/12/17 03:15:40 Given that we test all keys, this log will be very
Mike Meade 2014/12/18 18:54:24 Done.
+ 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;
Jamie 2014/12/17 03:15:40 I don't understand why the context menu affects wh
Jamie 2014/12/18 21:31:44 You haven't addressed this comment.
Mike Meade 2015/01/05 23:18:58 I removed this code until we could make it a bit m
+ int offset = 0;
+ switch (button) {
+ case blink::WebMouseEvent::ButtonLeft:
+ LOG(INFO) << "Clicking left mouse button";
Jamie 2014/12/17 03:15:40 This should probably also be a VLOG, although it w
Mike Meade 2014/12/18 18:54:24 Done.
+ break;
+ case blink::WebMouseEvent::ButtonMiddle:
+ LOG(INFO) << "Clicking middle mouse button";
+ break;
+ case blink::WebMouseEvent::ButtonRight:
+ LOG(INFO) << "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);
Jamie 2014/12/17 03:15:40 Can we also verify the location somehow? If that m
Jamie 2014/12/18 21:31:44 You haven't addressed this comment.
Mike Meade 2015/01/05 23:18:58 I removed this test for now. It seems to deserve i
}
void Me2MeBrowserTest::ConnectPinlessAndCleanupPairings(bool cleanup_all) {

Powered by Google App Engine
This is Rietveld 408576698