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" |
| 8 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
7 #include "chrome/common/chrome_paths.h" | 9 #include "chrome/common/chrome_paths.h" |
8 #include "chrome/common/url_constants.h" | 10 #include "chrome/common/url_constants.h" |
9 #include "chrome/test/base/ui_test_utils.h" | 11 #include "chrome/test/base/ui_test_utils.h" |
10 #include "chrome/test/base/web_ui_browser_test.h" | 12 #include "chrome/test/base/web_ui_browser_test.h" |
11 #include "net/test/embedded_test_server/embedded_test_server.h" | 13 #include "net/test/embedded_test_server/embedded_test_server.h" |
12 | 14 |
13 class WebUIWebViewBrowserTest : public WebUIBrowserTest { | 15 class WebUIWebViewBrowserTest : public WebUIBrowserTest { |
14 public: | 16 public: |
15 WebUIWebViewBrowserTest() {} | 17 WebUIWebViewBrowserTest() {} |
16 | 18 |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 new base::StringValue(GetTestUrl("empty.html").spec()))); | 126 new base::StringValue(GetTestUrl("empty.html").spec()))); |
125 } | 127 } |
126 | 128 |
127 IN_PROC_BROWSER_TEST_F(WebUIWebViewBrowserTest, AddContentScriptWithCode) { | 129 IN_PROC_BROWSER_TEST_F(WebUIWebViewBrowserTest, AddContentScriptWithCode) { |
128 ui_test_utils::NavigateToURL(browser(), GetWebViewEnabledWebUIURL()); | 130 ui_test_utils::NavigateToURL(browser(), GetWebViewEnabledWebUIURL()); |
129 | 131 |
130 ASSERT_TRUE(WebUIBrowserTest::RunJavascriptAsyncTest( | 132 ASSERT_TRUE(WebUIBrowserTest::RunJavascriptAsyncTest( |
131 "testAddContentScriptWithCode", | 133 "testAddContentScriptWithCode", |
132 new base::StringValue(GetTestUrl("empty.html").spec()))); | 134 new base::StringValue(GetTestUrl("empty.html").spec()))); |
133 } | 135 } |
| 136 |
| 137 #if defined(OS_CHROMEOS) |
| 138 // Right now we only have incognito WebUI on CrOS, but this should |
| 139 // theoretically work for all platforms. |
| 140 IN_PROC_BROWSER_TEST_F(WebUIWebViewBrowserTest, AddContentScriptIncognito) { |
| 141 Browser* incognito_browser = ui_test_utils::OpenURLOffTheRecord( |
| 142 browser()->profile(), GetWebViewEnabledWebUIURL()); |
| 143 |
| 144 SetWebUIInstance( |
| 145 incognito_browser->tab_strip_model()->GetActiveWebContents()->GetWebUI()); |
| 146 |
| 147 ASSERT_TRUE(WebUIBrowserTest::RunJavascriptAsyncTest( |
| 148 "testAddContentScript", |
| 149 new base::StringValue(GetTestUrl("empty.html").spec()))); |
| 150 } |
| 151 #endif |
OLD | NEW |