Add python coverage module to third_party
[chromium-blink-merge.git] / chrome / test / remoting / fullscreen_browsertest.cc
blob40819cdc6ff1ad9ba20ddbf7b7461d615db45c3a
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "base/files/file_path.h"
6 #include "base/files/file_util.h"
7 #include "chrome/test/remoting/remote_desktop_browsertest.h"
8 #include "chrome/test/remoting/waiter.h"
10 namespace remoting {
12 class FullscreenBrowserTest : public RemoteDesktopBrowserTest {
13 protected:
14 bool WaitForFullscreenChange(bool expect_fullscreen);
17 bool FullscreenBrowserTest::WaitForFullscreenChange(bool expect_fullscreen) {
18 std::string javascript = expect_fullscreen ?
19 "remoting.fullscreen.isActive()" :
20 "!remoting.fullscreen.isActive()";
21 ConditionalTimeoutWaiter waiter(
22 base::TimeDelta::FromSeconds(20),
23 base::TimeDelta::FromSeconds(1),
24 base::Bind(&RemoteDesktopBrowserTest::IsHostActionComplete,
25 active_web_contents(),
26 javascript));
27 bool result = waiter.Wait();
28 // Entering or leaving full-screen mode causes local and remote desktop
29 // reconfigurations that can take a while to settle down, so wait a few
30 // seconds before continuing.
31 TimeoutWaiter(base::TimeDelta::FromSeconds(10)).Wait();
32 return result;
35 IN_PROC_BROWSER_TEST_F(FullscreenBrowserTest, MANUAL_Me2Me_Fullscreen) {
36 SetUpTestForMe2Me();
37 ConnectToLocalHost(false);
39 // Verify that we're initially not full-screen.
40 EXPECT_FALSE(ExecuteScriptAndExtractBool(
41 "remoting.fullscreen.isActive()"));
43 // Click the full-screen button and verify that it activates full-screen mode.
44 ClickOnControl("toggle-full-screen");
45 EXPECT_TRUE(WaitForFullscreenChange(true));
47 // Click the full-screen button again and verify that it deactivates
48 // full-screen mode.
49 ClickOnControl("toggle-full-screen");
50 EXPECT_TRUE(WaitForFullscreenChange(false));
52 // Enter full-screen mode again, then disconnect and verify that full-screen
53 // mode is deactivated upon disconnection.
54 // TODO(jamiewalch): For the v2 app, activate full-screen mode indirectly by
55 // maximizing the window for the second test.
56 ClickOnControl("toggle-full-screen");
57 EXPECT_TRUE(WaitForFullscreenChange(true));
58 DisconnectMe2Me();
59 EXPECT_TRUE(WaitForFullscreenChange(false));
61 Cleanup();
64 IN_PROC_BROWSER_TEST_F(FullscreenBrowserTest, MANUAL_Me2Me_Bump_Scroll) {
65 SetUpTestForMe2Me();
67 content::WebContents* content = app_web_content();
68 LoadScript(content, FILE_PATH_LITERAL("bump_scroll_browser_test.js"));
70 RunJavaScriptTest(content, "Bump_Scroll", "{pin: '" + me2me_pin() + "'}");
72 Cleanup();
75 } // namespace remoting