| 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 "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
| 9 #include "base/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 380 EXPECT_TRUE(HtmlElementVisible("me2me-content")); | 380 EXPECT_TRUE(HtmlElementVisible("me2me-content")); |
| 381 EXPECT_FALSE(HtmlElementVisible("me2me-first-run")); | 381 EXPECT_FALSE(HtmlElementVisible("me2me-first-run")); |
| 382 } | 382 } |
| 383 | 383 |
| 384 void RemoteDesktopBrowserTest::DisconnectMe2Me() { | 384 void RemoteDesktopBrowserTest::DisconnectMe2Me() { |
| 385 // The chromoting extension should be installed. | 385 // The chromoting extension should be installed. |
| 386 ASSERT_TRUE(extension_); | 386 ASSERT_TRUE(extension_); |
| 387 | 387 |
| 388 ASSERT_TRUE(RemoteDesktopBrowserTest::IsSessionConnected()); | 388 ASSERT_TRUE(RemoteDesktopBrowserTest::IsSessionConnected()); |
| 389 | 389 |
| 390 ExecuteScript("remoting.app.disconnect();"); | 390 ExecuteScript("remoting.app.getActivity().stop();"); |
| 391 | 391 |
| 392 EXPECT_TRUE(HtmlElementVisible("client-dialog")); | 392 EXPECT_TRUE(HtmlElementVisible("client-dialog")); |
| 393 EXPECT_TRUE(HtmlElementVisible("client-reconnect-button")); | 393 EXPECT_TRUE(HtmlElementVisible("client-reconnect-button")); |
| 394 EXPECT_TRUE(HtmlElementVisible("client-finished-me2me-button")); | 394 EXPECT_TRUE(HtmlElementVisible("client-finished-me2me-button")); |
| 395 | 395 |
| 396 ClickOnControl("client-finished-me2me-button"); | 396 ClickOnControl("client-finished-me2me-button"); |
| 397 | 397 |
| 398 EXPECT_FALSE(HtmlElementVisible("client-dialog")); | 398 EXPECT_FALSE(HtmlElementVisible("client-dialog")); |
| 399 } | 399 } |
| 400 | 400 |
| (...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 834 return ExecuteScriptAndExtractBool( | 834 return ExecuteScriptAndExtractBool( |
| 835 "remoting.hostList != null && remoting.hostList.hosts_ != null"); | 835 "remoting.hostList != null && remoting.hostList.hosts_ != null"); |
| 836 } | 836 } |
| 837 | 837 |
| 838 bool RemoteDesktopBrowserTest::IsSessionConnected() { | 838 bool RemoteDesktopBrowserTest::IsSessionConnected() { |
| 839 // If some form of PINless authentication is enabled, the host version | 839 // If some form of PINless authentication is enabled, the host version |
| 840 // warning may appear while waiting for the session to connect. | 840 // warning may appear while waiting for the session to connect. |
| 841 DismissHostVersionWarningIfVisible(); | 841 DismissHostVersionWarningIfVisible(); |
| 842 | 842 |
| 843 return ExecuteScriptAndExtractBool( | 843 return ExecuteScriptAndExtractBool( |
| 844 "remoting.clientSession != null && " | 844 "remoting.currentMode === remoting.AppMode.IN_SESSION"); |
| 845 "remoting.clientSession.getState() == " | |
| 846 "remoting.ClientSession.State.CONNECTED"); | |
| 847 } | 845 } |
| 848 | 846 |
| 849 bool RemoteDesktopBrowserTest::IsPinFormVisible() { | 847 bool RemoteDesktopBrowserTest::IsPinFormVisible() { |
| 850 DismissHostVersionWarningIfVisible(); | 848 DismissHostVersionWarningIfVisible(); |
| 851 return HtmlElementVisible("pin-form"); | 849 return HtmlElementVisible("pin-form"); |
| 852 } | 850 } |
| 853 | 851 |
| 854 void RemoteDesktopBrowserTest::DismissHostVersionWarningIfVisible() { | 852 void RemoteDesktopBrowserTest::DismissHostVersionWarningIfVisible() { |
| 855 if (HtmlElementVisible("host-needs-update-connect-button")) | 853 if (HtmlElementVisible("host-needs-update-connect-button")) |
| 856 ClickOnControl("host-needs-update-connect-button"); | 854 ClickOnControl("host-needs-update-connect-button"); |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 928 | 926 |
| 929 ConditionalTimeoutWaiter homeWaiter( | 927 ConditionalTimeoutWaiter homeWaiter( |
| 930 base::TimeDelta::FromSeconds(5), | 928 base::TimeDelta::FromSeconds(5), |
| 931 base::TimeDelta::FromMilliseconds(500), | 929 base::TimeDelta::FromMilliseconds(500), |
| 932 base::Bind(&RemoteDesktopBrowserTest::IsAppModeEqualTo, | 930 base::Bind(&RemoteDesktopBrowserTest::IsAppModeEqualTo, |
| 933 this, "remoting.AppMode.HOME")); | 931 this, "remoting.AppMode.HOME")); |
| 934 EXPECT_TRUE(homeWaiter.Wait()); | 932 EXPECT_TRUE(homeWaiter.Wait()); |
| 935 } | 933 } |
| 936 | 934 |
| 937 } // namespace remoting | 935 } // namespace remoting |
| OLD | NEW |