OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "base/macros.h" | 5 #include "base/macros.h" |
6 #include "base/path_service.h" | 6 #include "base/path_service.h" |
7 #include "chrome/browser/ui/browser.h" | 7 #include "chrome/browser/ui/browser.h" |
8 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 8 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
9 #include "chrome/common/chrome_paths.h" | 9 #include "chrome/common/chrome_paths.h" |
10 #include "chrome/common/url_constants.h" | 10 #include "chrome/common/url_constants.h" |
11 #include "chrome/test/base/ui_test_utils.h" | 11 #include "chrome/test/base/ui_test_utils.h" |
12 #include "chrome/test/base/web_ui_browser_test.h" | 12 #include "chrome/test/base/web_ui_browser_test.h" |
13 #include "net/test/embedded_test_server/embedded_test_server.h" | 13 #include "net/test/embedded_test_server/embedded_test_server.h" |
14 | 14 |
15 class WebUIWebViewBrowserTest : public WebUIBrowserTest { | 15 class WebUIWebViewBrowserTest : public WebUIBrowserTest { |
16 public: | 16 public: |
17 WebUIWebViewBrowserTest() {} | 17 WebUIWebViewBrowserTest() {} |
18 | 18 |
19 void SetUpOnMainThread() override { | 19 void SetUpOnMainThread() override { |
20 WebUIBrowserTest::SetUpOnMainThread(); | 20 WebUIBrowserTest::SetUpOnMainThread(); |
21 AddLibrary( | 21 AddLibrary( |
22 base::FilePath(FILE_PATH_LITERAL("webview_content_script_test.js"))); | 22 base::FilePath(FILE_PATH_LITERAL("webview_content_script_test.js"))); |
23 AddLibrary( | 23 AddLibrary( |
24 base::FilePath(FILE_PATH_LITERAL("webview_basic.js"))); | 24 base::FilePath(FILE_PATH_LITERAL("webview_basic.js"))); |
25 | 25 |
26 base::FilePath test_data_dir; | 26 base::FilePath test_data_dir; |
27 PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir); | 27 PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir); |
28 embedded_test_server()->ServeFilesFromDirectory(test_data_dir); | 28 embedded_test_server()->ServeFilesFromDirectory(test_data_dir); |
29 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 29 ASSERT_TRUE(embedded_test_server()->Start()); |
30 } | 30 } |
31 | 31 |
32 GURL GetTestUrl(const std::string& path) const { | 32 GURL GetTestUrl(const std::string& path) const { |
33 return embedded_test_server()->base_url().Resolve(path); | 33 return embedded_test_server()->base_url().Resolve(path); |
34 } | 34 } |
35 | 35 |
36 GURL GetWebViewEnabledWebUIURL() const { | 36 GURL GetWebViewEnabledWebUIURL() const { |
37 return GURL(chrome::kChromeUIChromeSigninURL); | 37 return GURL(chrome::kChromeUIChromeSigninURL); |
38 } | 38 } |
39 | 39 |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 OpenURLOffTheRecord(browser()->profile(), GetWebViewEnabledWebUIURL()); | 155 OpenURLOffTheRecord(browser()->profile(), GetWebViewEnabledWebUIURL()); |
156 | 156 |
157 SetWebUIInstance( | 157 SetWebUIInstance( |
158 incognito_browser->tab_strip_model()->GetActiveWebContents()->GetWebUI()); | 158 incognito_browser->tab_strip_model()->GetActiveWebContents()->GetWebUI()); |
159 | 159 |
160 ASSERT_TRUE(WebUIBrowserTest::RunJavascriptAsyncTest( | 160 ASSERT_TRUE(WebUIBrowserTest::RunJavascriptAsyncTest( |
161 "testAddContentScript", | 161 "testAddContentScript", |
162 new base::StringValue(GetTestUrl("empty.html").spec()))); | 162 new base::StringValue(GetTestUrl("empty.html").spec()))); |
163 } | 163 } |
164 #endif | 164 #endif |
OLD | NEW |