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); | |
20 }; | 19 }; |
21 | 20 |
22 IN_PROC_BROWSER_TEST_F(Me2MeBrowserTest, | 21 IN_PROC_BROWSER_TEST_F(Me2MeBrowserTest, |
23 MANUAL_Me2Me_Connect_Local_Host) { | 22 MANUAL_Me2Me_Connect_Local_Host) { |
24 SetUpTestForMe2Me(); | 23 SetUpTestForMe2Me(); |
25 | 24 |
26 ConnectToLocalHost(false); | 25 ConnectToLocalHost(false); |
27 | 26 |
28 // TODO(chaitali): Change the mouse input test to also work in the | 27 // TODO(chaitali): Change the mouse input test to also work in the |
29 // HTTP server framework | 28 // HTTP server framework |
(...skipping 30 matching lines...) Expand all Loading... |
60 ASSERT_FALSE(HtmlElementVisible("paired-client-manager-message")) | 59 ASSERT_FALSE(HtmlElementVisible("paired-client-manager-message")) |
61 << "The host must have no pairings before running the pinless test."; | 60 << "The host must have no pairings before running the pinless test."; |
62 | 61 |
63 // Test that cleanup works with either the Delete or Delete all buttons. | 62 // Test that cleanup works with either the Delete or Delete all buttons. |
64 ConnectPinlessAndCleanupPairings(false); | 63 ConnectPinlessAndCleanupPairings(false); |
65 ConnectPinlessAndCleanupPairings(true); | 64 ConnectPinlessAndCleanupPairings(true); |
66 | 65 |
67 Cleanup(); | 66 Cleanup(); |
68 } | 67 } |
69 | 68 |
70 IN_PROC_BROWSER_TEST_F(Me2MeBrowserTest, MANUAL_Me2Me_Fullscreen) { | |
71 VerifyInternetAccess(); | |
72 Install(); | |
73 LaunchChromotingApp(); | |
74 | |
75 // Authorize, Authenticate, and Approve. | |
76 Auth(); | |
77 ExpandMe2Me(); | |
78 | |
79 ConnectToLocalHost(false); | |
80 | |
81 // Verify that we're initially not full-screen. | |
82 EXPECT_FALSE(ExecuteScriptAndExtractBool( | |
83 "remoting.fullscreen.isActive()")); | |
84 | |
85 // Click the full-screen button and verify that it activates full-screen mode. | |
86 ClickOnControl("toggle-full-screen"); | |
87 EXPECT_TRUE(WaitForFullscreenChange(true)); | |
88 | |
89 // Click the full-screen button again and verify that it deactivates | |
90 // full-screen mode. | |
91 ClickOnControl("toggle-full-screen"); | |
92 EXPECT_TRUE(WaitForFullscreenChange(false)); | |
93 | |
94 // Enter full-screen mode again, then disconnect and verify that full-screen | |
95 // mode is deactivated upon disconnection. | |
96 // TODO(jamiewalch): For the v2 app, activate full-screen mode indirectly by | |
97 // maximizing the window for the second test. | |
98 ClickOnControl("toggle-full-screen"); | |
99 EXPECT_TRUE(WaitForFullscreenChange(true)); | |
100 DisconnectMe2Me(); | |
101 EXPECT_TRUE(WaitForFullscreenChange(false)); | |
102 | |
103 Cleanup(); | |
104 } | |
105 | |
106 void Me2MeBrowserTest::TestKeyboardInput() { | 69 void Me2MeBrowserTest::TestKeyboardInput() { |
107 // We will assume here that the browser window is already open on the host | 70 // We will assume here that the browser window is already open on the host |
108 // and in focus. | 71 // and in focus. |
109 // Press tab to put focus on the textbox. | 72 // Press tab to put focus on the textbox. |
110 SimulateKeyPressWithCode(ui::VKEY_TAB, "Tab", false, false, false, false); | 73 SimulateKeyPressWithCode(ui::VKEY_TAB, "Tab", false, false, false, false); |
111 | 74 |
112 // Write some text in the box and press enter | 75 // Write some text in the box and press enter |
113 std::string text = "Abigail"; | 76 std::string text = "Abigail"; |
114 SimulateStringInput(text); | 77 SimulateStringInput(text); |
115 SimulateKeyPressWithCode( | 78 SimulateKeyPressWithCode( |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 | 143 |
181 ClickOnControl("close-paired-client-manager-dialog"); | 144 ClickOnControl("close-paired-client-manager-dialog"); |
182 ASSERT_FALSE(HtmlElementVisible("paired-client-manager-dialog")); | 145 ASSERT_FALSE(HtmlElementVisible("paired-client-manager-dialog")); |
183 ASSERT_FALSE(HtmlElementVisible("paired-client-manager-message")); | 146 ASSERT_FALSE(HtmlElementVisible("paired-client-manager-message")); |
184 } | 147 } |
185 | 148 |
186 bool Me2MeBrowserTest::IsPairingSpinnerHidden() { | 149 bool Me2MeBrowserTest::IsPairingSpinnerHidden() { |
187 return !HtmlElementVisible("paired-client-manager-dialog-working"); | 150 return !HtmlElementVisible("paired-client-manager-dialog-working"); |
188 } | 151 } |
189 | 152 |
190 bool Me2MeBrowserTest::WaitForFullscreenChange(bool expect_fullscreen) { | |
191 std::string javascript = expect_fullscreen ? | |
192 "remoting.fullscreen.isActive()" : | |
193 "!remoting.fullscreen.isActive()"; | |
194 ConditionalTimeoutWaiter waiter( | |
195 base::TimeDelta::FromSeconds(10), | |
196 base::TimeDelta::FromMilliseconds(500), | |
197 base::Bind(&RemoteDesktopBrowserTest::IsHostActionComplete, | |
198 active_web_contents(), | |
199 javascript)); | |
200 return waiter.Wait(); | |
201 } | |
202 | |
203 } // namespace remoting | 153 } // namespace remoting |
OLD | NEW |