| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 <stdint.h> | 5 #include <stdint.h> |
| 6 | 6 |
| 7 #include "base/strings/string_number_conversions.h" | 7 #include "base/strings/string_number_conversions.h" |
| 8 #include "chrome/test/remoting/remote_desktop_browsertest.h" | 8 #include "chrome/test/remoting/remote_desktop_browsertest.h" |
| 9 | 9 |
| 10 namespace remoting { | 10 namespace remoting { |
| 11 | 11 |
| 12 class It2MeBrowserTest : public RemoteDesktopBrowserTest { | 12 class It2MeBrowserTest : public RemoteDesktopBrowserTest { |
| 13 protected: | 13 protected: |
| 14 std::string GetAccessCode(content::WebContents* contents); | 14 std::string GetAccessCode(content::WebContents* contents); |
| 15 | 15 |
| 16 // Launches a Chromoting app instance for the helper. | 16 // Launches a Chromoting app instance for the helper. |
| 17 content::WebContents* SetUpHelperInstance(); | 17 content::WebContents* SetUpHelperInstance(); |
| 18 }; | 18 }; |
| 19 | 19 |
| 20 std::string It2MeBrowserTest::GetAccessCode(content::WebContents* contents) { | 20 std::string It2MeBrowserTest::GetAccessCode(content::WebContents* contents) { |
| 21 RunJavaScriptTest(contents, "GetAccessCode", "{}"); | 21 RunJavaScriptTest(contents, "GetAccessCode", "{}"); |
| 22 std::string access_code = RemoteTestHelper::ExecuteScriptAndExtractString( | 22 std::string access_code = RemoteTestHelper::ExecuteScriptAndExtractString( |
| 23 contents, "document.getElementById('access-code-display').innerText"); | 23 contents, "document.getElementById('access-code-display').innerText"); |
| 24 return access_code; | 24 return access_code; |
| 25 } | 25 } |
| 26 | 26 |
| 27 content::WebContents* It2MeBrowserTest::SetUpHelperInstance() { | 27 content::WebContents* It2MeBrowserTest::SetUpHelperInstance() { |
| 28 content::WebContents* helper_content = | 28 content::WebContents* helper_content = |
| 29 LaunchChromotingApp(false, NEW_FOREGROUND_TAB); | 29 LaunchChromotingApp(false, WindowOpenDisposition::NEW_FOREGROUND_TAB); |
| 30 LoadBrowserTestJavaScript(helper_content); | 30 LoadBrowserTestJavaScript(helper_content); |
| 31 LoadScript(helper_content, FILE_PATH_LITERAL("it2me_browser_test.js")); | 31 LoadScript(helper_content, FILE_PATH_LITERAL("it2me_browser_test.js")); |
| 32 return helper_content; | 32 return helper_content; |
| 33 } | 33 } |
| 34 | 34 |
| 35 IN_PROC_BROWSER_TEST_F(It2MeBrowserTest, MANUAL_Connect) { | 35 IN_PROC_BROWSER_TEST_F(It2MeBrowserTest, MANUAL_Connect) { |
| 36 content::WebContents* helpee_content = SetUpTest(); | 36 content::WebContents* helpee_content = SetUpTest(); |
| 37 LoadScript(helpee_content, FILE_PATH_LITERAL("it2me_browser_test.js")); | 37 LoadScript(helpee_content, FILE_PATH_LITERAL("it2me_browser_test.js")); |
| 38 | 38 |
| 39 content::WebContents* helper_content = SetUpHelperInstance(); | 39 content::WebContents* helper_content = SetUpHelperInstance(); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 | 89 |
| 90 content::WebContents* helper_content = SetUpHelperInstance(); | 90 content::WebContents* helper_content = SetUpHelperInstance(); |
| 91 RunJavaScriptTest(helper_content, "InvalidAccessCode", "{" | 91 RunJavaScriptTest(helper_content, "InvalidAccessCode", "{" |
| 92 "accessCode: '" + invalid_access_code_string.str() + "'" | 92 "accessCode: '" + invalid_access_code_string.str() + "'" |
| 93 "}"); | 93 "}"); |
| 94 | 94 |
| 95 Cleanup(); | 95 Cleanup(); |
| 96 } | 96 } |
| 97 | 97 |
| 98 } // namespace remoting | 98 } // namespace remoting |
| OLD | NEW |