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 "base/file_util.h" | 5 #include "base/file_util.h" |
6 #include "base/files/file_path.h" | 6 #include "base/files/file_path.h" |
7 #include "chrome/test/remoting/remote_desktop_browsertest.h" | 7 #include "chrome/test/remoting/remote_desktop_browsertest.h" |
8 #include "chrome/test/remoting/waiter.h" | 8 #include "chrome/test/remoting/waiter.h" |
9 | 9 |
10 namespace remoting { | 10 namespace remoting { |
11 | 11 |
12 class Me2MeBrowserTest : public RemoteDesktopBrowserTest { | 12 class Me2MeBrowserTest : public RemoteDesktopBrowserTest { |
13 protected: | 13 protected: |
14 void TestKeyboardInput(); | 14 void TestKeyboardInput(); |
15 void TestMouseInput(); | 15 void TestMouseInput(); |
16 | 16 |
17 void ConnectPinlessAndCleanupPairings(bool cleanup_all); | 17 void ConnectPinlessAndCleanupPairings(bool cleanup_all); |
18 bool IsPairingSpinnerHidden(); | 18 bool IsPairingSpinnerHidden(); |
| 19 bool WaitForFullscreenChange(bool expect_fullscreen); |
19 }; | 20 }; |
20 | 21 |
21 IN_PROC_BROWSER_TEST_F(Me2MeBrowserTest, | 22 IN_PROC_BROWSER_TEST_F(Me2MeBrowserTest, |
22 MANUAL_Me2Me_Connect_Local_Host) { | 23 MANUAL_Me2Me_Connect_Local_Host) { |
23 VerifyInternetAccess(); | 24 VerifyInternetAccess(); |
24 Install(); | 25 Install(); |
25 LaunchChromotingApp(); | 26 LaunchChromotingApp(); |
26 | 27 |
27 // Authorize, Authenticate, and Approve. | 28 // Authorize, Authenticate, and Approve. |
28 Auth(); | 29 Auth(); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 ASSERT_FALSE(HtmlElementVisible("paired-client-manager-message")) | 72 ASSERT_FALSE(HtmlElementVisible("paired-client-manager-message")) |
72 << "The host must have no pairings before running the pinless test."; | 73 << "The host must have no pairings before running the pinless test."; |
73 | 74 |
74 // Test that cleanup works with either the Delete or Delete all buttons. | 75 // Test that cleanup works with either the Delete or Delete all buttons. |
75 ConnectPinlessAndCleanupPairings(false); | 76 ConnectPinlessAndCleanupPairings(false); |
76 ConnectPinlessAndCleanupPairings(true); | 77 ConnectPinlessAndCleanupPairings(true); |
77 | 78 |
78 Cleanup(); | 79 Cleanup(); |
79 } | 80 } |
80 | 81 |
| 82 IN_PROC_BROWSER_TEST_F(Me2MeBrowserTest, MANUAL_Me2Me_Fullscreen) { |
| 83 VerifyInternetAccess(); |
| 84 Install(); |
| 85 LaunchChromotingApp(); |
| 86 |
| 87 // Authorize, Authenticate, and Approve. |
| 88 Auth(); |
| 89 ExpandMe2Me(); |
| 90 |
| 91 ConnectToLocalHost(false); |
| 92 |
| 93 // Verify that we're initially not full-screen. |
| 94 EXPECT_FALSE(ExecuteScriptAndExtractBool( |
| 95 "remoting.fullscreen.isActive()")); |
| 96 |
| 97 // Click the full-screen button and verify that it activates full-screen mode. |
| 98 ClickOnControl("toggle-full-screen"); |
| 99 EXPECT_TRUE(WaitForFullscreenChange(true)); |
| 100 |
| 101 // Click the full-screen button again and verify that it deactivates |
| 102 // full-screen mode. |
| 103 ClickOnControl("toggle-full-screen"); |
| 104 EXPECT_TRUE(WaitForFullscreenChange(false)); |
| 105 |
| 106 // Enter full-screen mode again, then disconnect and verify that full-screen |
| 107 // mode is deactivated upon disconnection. |
| 108 // TODO(jamiewalch): For the v2 app, activate full-screen mode indirectly by |
| 109 // maximizing the window for the second test. |
| 110 ClickOnControl("toggle-full-screen"); |
| 111 EXPECT_TRUE(WaitForFullscreenChange(true)); |
| 112 DisconnectMe2Me(); |
| 113 EXPECT_TRUE(WaitForFullscreenChange(false)); |
| 114 |
| 115 Cleanup(); |
| 116 } |
| 117 |
81 void Me2MeBrowserTest::TestKeyboardInput() { | 118 void Me2MeBrowserTest::TestKeyboardInput() { |
82 // We will assume here that the browser window is already open on the host | 119 // We will assume here that the browser window is already open on the host |
83 // and in focus. | 120 // and in focus. |
84 // Press tab to put focus on the textbox. | 121 // Press tab to put focus on the textbox. |
85 SimulateKeyPressWithCode(ui::VKEY_TAB, "Tab", false, false, false, false); | 122 SimulateKeyPressWithCode(ui::VKEY_TAB, "Tab", false, false, false, false); |
86 | 123 |
87 // Write some text in the box and press enter | 124 // Write some text in the box and press enter |
88 std::string text = "Abigail"; | 125 std::string text = "Abigail"; |
89 SimulateStringInput(text); | 126 SimulateStringInput(text); |
90 SimulateKeyPressWithCode( | 127 SimulateKeyPressWithCode( |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 | 192 |
156 ClickOnControl("close-paired-client-manager-dialog"); | 193 ClickOnControl("close-paired-client-manager-dialog"); |
157 ASSERT_FALSE(HtmlElementVisible("paired-client-manager-dialog")); | 194 ASSERT_FALSE(HtmlElementVisible("paired-client-manager-dialog")); |
158 ASSERT_FALSE(HtmlElementVisible("paired-client-manager-message")); | 195 ASSERT_FALSE(HtmlElementVisible("paired-client-manager-message")); |
159 } | 196 } |
160 | 197 |
161 bool Me2MeBrowserTest::IsPairingSpinnerHidden() { | 198 bool Me2MeBrowserTest::IsPairingSpinnerHidden() { |
162 return !HtmlElementVisible("paired-client-manager-dialog-working"); | 199 return !HtmlElementVisible("paired-client-manager-dialog-working"); |
163 } | 200 } |
164 | 201 |
| 202 bool Me2MeBrowserTest::WaitForFullscreenChange(bool expect_fullscreen) { |
| 203 std::string javascript = expect_fullscreen ? |
| 204 "remoting.fullscreen.isActive()" : |
| 205 "!remoting.fullscreen.isActive()"; |
| 206 ConditionalTimeoutWaiter waiter( |
| 207 base::TimeDelta::FromSeconds(10), |
| 208 base::TimeDelta::FromMilliseconds(500), |
| 209 base::Bind(&RemoteDesktopBrowserTest::IsHostActionComplete, |
| 210 active_web_contents(), |
| 211 javascript)); |
| 212 return waiter.Wait(); |
| 213 } |
| 214 |
165 } // namespace remoting | 215 } // namespace remoting |
OLD | NEW |