| 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 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 550 void RemoteDesktopBrowserTest::ConnectToLocalHost(bool remember_pin) { | 550 void RemoteDesktopBrowserTest::ConnectToLocalHost(bool remember_pin) { |
| 551 // Wait for local-host to be ready. | 551 // Wait for local-host to be ready. |
| 552 ConditionalTimeoutWaiter waiter( | 552 ConditionalTimeoutWaiter waiter( |
| 553 base::TimeDelta::FromSeconds(5), | 553 base::TimeDelta::FromSeconds(5), |
| 554 base::TimeDelta::FromMilliseconds(500), | 554 base::TimeDelta::FromMilliseconds(500), |
| 555 base::Bind(&RemoteDesktopBrowserTest::IsLocalHostReady, this)); | 555 base::Bind(&RemoteDesktopBrowserTest::IsLocalHostReady, this)); |
| 556 EXPECT_TRUE(waiter.Wait()); | 556 EXPECT_TRUE(waiter.Wait()); |
| 557 | 557 |
| 558 // Verify that the local host is online. | 558 // Verify that the local host is online. |
| 559 ASSERT_TRUE(ExecuteScriptAndExtractBool( | 559 ASSERT_TRUE(ExecuteScriptAndExtractBool( |
| 560 "remoting.hostList.localHost_.hostName && " | 560 "remoting.hostList.localHostSection_.host_.hostName && " |
| 561 "remoting.hostList.localHost_.hostId && " | 561 "remoting.hostList.localHostSection_.host_.hostId && " |
| 562 "remoting.hostList.localHost_.status && " | 562 "remoting.hostList.localHostSection_.host_.status && " |
| 563 "remoting.hostList.localHost_.status == 'ONLINE'")); | 563 "remoting.hostList.localHostSection_.host_.status == 'ONLINE'")); |
| 564 | 564 |
| 565 // Connect. | 565 // Connect. |
| 566 ClickOnControl("this-host-connect"); | 566 ClickOnControl("local-host-connect-button"); |
| 567 | 567 |
| 568 // Enter the pin # passed in from the command line. | 568 // Enter the pin # passed in from the command line. |
| 569 EnterPin(me2me_pin(), remember_pin); | 569 EnterPin(me2me_pin(), remember_pin); |
| 570 | 570 |
| 571 WaitForConnection(); | 571 WaitForConnection(); |
| 572 } | 572 } |
| 573 | 573 |
| 574 void RemoteDesktopBrowserTest::ConnectToRemoteHost( | 574 void RemoteDesktopBrowserTest::ConnectToRemoteHost( |
| 575 const std::string& host_name, bool remember_pin) { | 575 const std::string& host_name, bool remember_pin) { |
| 576 | 576 |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 816 | 816 |
| 817 // The client is not yet ready to take input when the session state becomes | 817 // The client is not yet ready to take input when the session state becomes |
| 818 // CONNECTED. Wait for 2 seconds for the client to become ready. | 818 // CONNECTED. Wait for 2 seconds for the client to become ready. |
| 819 // TODO(weitaosu): Find a way to detect when the client is truly ready. | 819 // TODO(weitaosu): Find a way to detect when the client is truly ready. |
| 820 TimeoutWaiter(base::TimeDelta::FromSeconds(2)).Wait(); | 820 TimeoutWaiter(base::TimeDelta::FromSeconds(2)).Wait(); |
| 821 } | 821 } |
| 822 | 822 |
| 823 bool RemoteDesktopBrowserTest::IsLocalHostReady() { | 823 bool RemoteDesktopBrowserTest::IsLocalHostReady() { |
| 824 // TODO(weitaosu): Instead of polling, can we register a callback to | 824 // TODO(weitaosu): Instead of polling, can we register a callback to |
| 825 // remoting.hostList.setLocalHost_? | 825 // remoting.hostList.setLocalHost_? |
| 826 return ExecuteScriptAndExtractBool("remoting.hostList.localHost_ != null"); | 826 return ExecuteScriptAndExtractBool( |
| 827 "remoting.hostList.localHostSection_.host_ != null"); |
| 827 } | 828 } |
| 828 | 829 |
| 829 bool RemoteDesktopBrowserTest::IsHostListReady() { | 830 bool RemoteDesktopBrowserTest::IsHostListReady() { |
| 830 // Wait until hostList is not null. | 831 // Wait until hostList is not null. |
| 831 // The connect-to-host tests are run on the waterfall using a new profile-dir. | 832 // The connect-to-host tests are run on the waterfall using a new profile-dir. |
| 832 // No hosts will be cached. | 833 // No hosts will be cached. |
| 833 return ExecuteScriptAndExtractBool( | 834 return ExecuteScriptAndExtractBool( |
| 834 "remoting.hostList != null && remoting.hostList.hosts_ != null"); | 835 "remoting.hostList != null && remoting.hostList.hosts_ != null"); |
| 835 } | 836 } |
| 836 | 837 |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 927 | 928 |
| 928 ConditionalTimeoutWaiter homeWaiter( | 929 ConditionalTimeoutWaiter homeWaiter( |
| 929 base::TimeDelta::FromSeconds(5), | 930 base::TimeDelta::FromSeconds(5), |
| 930 base::TimeDelta::FromMilliseconds(500), | 931 base::TimeDelta::FromMilliseconds(500), |
| 931 base::Bind(&RemoteDesktopBrowserTest::IsAppModeEqualTo, | 932 base::Bind(&RemoteDesktopBrowserTest::IsAppModeEqualTo, |
| 932 this, "remoting.AppMode.HOME")); | 933 this, "remoting.AppMode.HOME")); |
| 933 EXPECT_TRUE(homeWaiter.Wait()); | 934 EXPECT_TRUE(homeWaiter.Wait()); |
| 934 } | 935 } |
| 935 | 936 |
| 936 } // namespace remoting | 937 } // namespace remoting |
| OLD | NEW |