Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(332)

Side by Side Diff: chrome/browser/ui/webui/webui_webview_browsertest.cc

Issue 1062963006: Make WebUI webview content script work with incognito. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@webui_api_4
Patch Set: Comments Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | extensions/browser/web_ui_user_script_loader.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « no previous file | extensions/browser/web_ui_user_script_loader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698