Chromium Code Reviews| 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 11 matching lines...) Expand all Loading... | |
| 22 #include "extensions/browser/extension_registry.h" | 22 #include "extensions/browser/extension_registry.h" |
| 23 #include "extensions/common/constants.h" | 23 #include "extensions/common/constants.h" |
| 24 #include "extensions/common/extension.h" | 24 #include "extensions/common/extension.h" |
| 25 #include "extensions/common/extension_set.h" | 25 #include "extensions/common/extension_set.h" |
| 26 #include "extensions/common/switches.h" | 26 #include "extensions/common/switches.h" |
| 27 #include "ui/base/window_open_disposition.h" | 27 #include "ui/base/window_open_disposition.h" |
| 28 | 28 |
| 29 namespace remoting { | 29 namespace remoting { |
| 30 | 30 |
| 31 RemoteDesktopBrowserTest::RemoteDesktopBrowserTest() | 31 RemoteDesktopBrowserTest::RemoteDesktopBrowserTest() |
| 32 : extension_(NULL) { | 32 : remote_test_helper_(NULL), extension_(NULL) { |
|
Jamie
2014/12/17 03:15:40
Use nullptr in new code (might as well update |ext
Mike Meade
2014/12/18 18:54:24
Done.
| |
| 33 } | 33 } |
| 34 | 34 |
| 35 RemoteDesktopBrowserTest::~RemoteDesktopBrowserTest() {} | 35 RemoteDesktopBrowserTest::~RemoteDesktopBrowserTest() {} |
| 36 | 36 |
| 37 void RemoteDesktopBrowserTest::SetUp() { | 37 void RemoteDesktopBrowserTest::SetUp() { |
| 38 ParseCommandLine(); | 38 ParseCommandLine(); |
| 39 PlatformAppBrowserTest::SetUp(); | 39 PlatformAppBrowserTest::SetUp(); |
| 40 } | 40 } |
| 41 | 41 |
| 42 void RemoteDesktopBrowserTest::SetUpOnMainThread() { | 42 void RemoteDesktopBrowserTest::SetUpOnMainThread() { |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 65 ui_test_utils::NavigateToURLBlockUntilNavigationsComplete( | 65 ui_test_utils::NavigateToURLBlockUntilNavigationsComplete( |
| 66 browser(), GURL("http://www.google.com"), 1); | 66 browser(), GURL("http://www.google.com"), 1); |
| 67 | 67 |
| 68 EXPECT_EQ(GetCurrentURL().host(), "www.google.com"); | 68 EXPECT_EQ(GetCurrentURL().host(), "www.google.com"); |
| 69 } | 69 } |
| 70 | 70 |
| 71 void RemoteDesktopBrowserTest::OpenClientBrowserPage() { | 71 void RemoteDesktopBrowserTest::OpenClientBrowserPage() { |
| 72 // Open the client browser page in a new tab | 72 // Open the client browser page in a new tab |
| 73 ui_test_utils::NavigateToURLWithDisposition( | 73 ui_test_utils::NavigateToURLWithDisposition( |
| 74 browser(), | 74 browser(), |
| 75 GURL(http_server() + "/clientpage.html"), | 75 GURL(http_server() + "/client.html"), |
| 76 NEW_FOREGROUND_TAB, ui_test_utils::BROWSER_TEST_WAIT_FOR_TAB); | 76 NEW_FOREGROUND_TAB, ui_test_utils::BROWSER_TEST_WAIT_FOR_TAB); |
| 77 | 77 |
| 78 // Save this web content for later reference | 78 // Save this web content for later reference |
| 79 client_web_content_ = browser()->tab_strip_model()->GetActiveWebContents(); | 79 client_web_content_ = browser()->tab_strip_model()->GetActiveWebContents(); |
| 80 | 80 |
| 81 // Go back to the previous tab that has chromoting opened | 81 // Go back to the previous tab that has chromoting opened |
| 82 browser()->tab_strip_model()->SelectPreviousTab(); | 82 browser()->tab_strip_model()->SelectPreviousTab(); |
| 83 | |
| 84 // Create the RemoteTestHelper object to use. | |
| 85 remote_test_helper_ = RemoteTestHelper(client_web_content_); | |
|
Jamie
2014/12/17 03:15:40
I don't know what the style guide has to say about
Mike Meade
2014/12/18 18:54:24
Done.
| |
| 83 } | 86 } |
| 84 | 87 |
| 85 bool RemoteDesktopBrowserTest::HtmlElementVisible(const std::string& name) { | 88 bool RemoteDesktopBrowserTest::HtmlElementVisible(const std::string& name) { |
| 86 _ASSERT_TRUE(HtmlElementExists(name)); | 89 _ASSERT_TRUE(HtmlElementExists(name)); |
| 87 | 90 |
| 88 ExecuteScript( | 91 ExecuteScript( |
| 89 "function isElementVisible(name) {" | 92 "function isElementVisible(name) {" |
| 90 " var element = document.getElementById(name);" | 93 " var element = document.getElementById(name);" |
| 91 " /* The existence of the element has already been ASSERTed. */" | 94 " /* The existence of the element has already been ASSERTed. */" |
| 92 " do {" | 95 " do {" |
| (...skipping 794 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 887 // static | 890 // static |
| 888 bool RemoteDesktopBrowserTest::IsEnabled( | 891 bool RemoteDesktopBrowserTest::IsEnabled( |
| 889 content::WebContents* client_web_content, | 892 content::WebContents* client_web_content, |
| 890 const std::string& element_name) { | 893 const std::string& element_name) { |
| 891 return !ExecuteScriptAndExtractBool( | 894 return !ExecuteScriptAndExtractBool( |
| 892 client_web_content, | 895 client_web_content, |
| 893 "document.getElementById(\"" + element_name + "\").disabled"); | 896 "document.getElementById(\"" + element_name + "\").disabled"); |
| 894 } | 897 } |
| 895 | 898 |
| 896 } // namespace remoting | 899 } // namespace remoting |
| OLD | NEW |