OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/command_line.h" | 5 #include "base/command_line.h" |
6 #include "chrome/browser/extensions/api/web_request/web_request_api.h" | 6 #include "chrome/browser/extensions/api/web_request/web_request_api.h" |
7 #include "chrome/browser/extensions/extension_apitest.h" | 7 #include "chrome/browser/extensions/extension_apitest.h" |
8 #include "chrome/browser/extensions/extension_service.h" | 8 #include "chrome/browser/extensions/extension_service.h" |
9 #include "chrome/browser/extensions/extension_system.h" | 9 #include "chrome/browser/extensions/extension_system.h" |
10 #include "chrome/browser/extensions/extension_test_message_listener.h" | 10 #include "chrome/browser/extensions/extension_test_message_listener.h" |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 // Test that navigation in regular window is properly redirected. | 184 // Test that navigation in regular window is properly redirected. |
185 EXPECT_TRUE(listener.WaitUntilSatisfied()); | 185 EXPECT_TRUE(listener.WaitUntilSatisfied()); |
186 | 186 |
187 // This navigation should be redirected. | 187 // This navigation should be redirected. |
188 ui_test_utils::NavigateToURL( | 188 ui_test_utils::NavigateToURL( |
189 browser(), | 189 browser(), |
190 test_server()->GetURL("files/extensions/test_file.html")); | 190 test_server()->GetURL("files/extensions/test_file.html")); |
191 | 191 |
192 std::string body; | 192 std::string body; |
193 WebContents* tab = chrome::GetActiveWebContents(browser()); | 193 WebContents* tab = chrome::GetActiveWebContents(browser()); |
194 ASSERT_TRUE(content::ExecuteJavaScriptAndExtractString( | 194 ASSERT_TRUE(content::ExecuteScriptAndExtractString( |
195 tab->GetRenderViewHost(), | 195 tab, |
196 "", | |
197 "window.domAutomationController.send(document.body.textContent)", | 196 "window.domAutomationController.send(document.body.textContent)", |
198 &body)); | 197 &body)); |
199 EXPECT_EQ(expected_content_regular_window, body); | 198 EXPECT_EQ(expected_content_regular_window, body); |
200 | 199 |
201 // Test that navigation in OTR window is properly redirected. | 200 // Test that navigation in OTR window is properly redirected. |
202 Browser* otr_browser = ui_test_utils::OpenURLOffTheRecord( | 201 Browser* otr_browser = ui_test_utils::OpenURLOffTheRecord( |
203 browser()->profile(), GURL("about:blank")); | 202 browser()->profile(), GURL("about:blank")); |
204 | 203 |
205 if (wait_for_extension_loaded_in_incognito) | 204 if (wait_for_extension_loaded_in_incognito) |
206 EXPECT_TRUE(listener_incognito.WaitUntilSatisfied()); | 205 EXPECT_TRUE(listener_incognito.WaitUntilSatisfied()); |
207 | 206 |
208 // This navigation should be redirected if | 207 // This navigation should be redirected if |
209 // load_extension_with_incognito_permission is true. | 208 // load_extension_with_incognito_permission is true. |
210 ui_test_utils::NavigateToURL( | 209 ui_test_utils::NavigateToURL( |
211 otr_browser, | 210 otr_browser, |
212 test_server()->GetURL("files/extensions/test_file.html")); | 211 test_server()->GetURL("files/extensions/test_file.html")); |
213 | 212 |
214 body.clear(); | 213 body.clear(); |
215 WebContents* otr_tab = chrome::GetActiveWebContents(otr_browser); | 214 WebContents* otr_tab = chrome::GetActiveWebContents(otr_browser); |
216 ASSERT_TRUE(content::ExecuteJavaScriptAndExtractString( | 215 ASSERT_TRUE(content::ExecuteScriptAndExtractString( |
217 otr_tab->GetRenderViewHost(), | 216 otr_tab, |
218 "", | |
219 "window.domAutomationController.send(document.body.textContent)", | 217 "window.domAutomationController.send(document.body.textContent)", |
220 &body)); | 218 &body)); |
221 EXPECT_EQ(exptected_content_incognito_window, body); | 219 EXPECT_EQ(exptected_content_incognito_window, body); |
222 } | 220 } |
223 | 221 |
224 IN_PROC_BROWSER_TEST_F(ExtensionWebRequestApiTest, | 222 IN_PROC_BROWSER_TEST_F(ExtensionWebRequestApiTest, |
225 WebRequestDeclarativePermissionSpanning1) { | 223 WebRequestDeclarativePermissionSpanning1) { |
226 // Test spanning with incognito permission. | 224 // Test spanning with incognito permission. |
227 RunPermissionTest("spanning", true, false, "redirected1", "redirected1"); | 225 RunPermissionTest("spanning", true, false, "redirected1", "redirected1"); |
228 } | 226 } |
(...skipping 30 matching lines...) Expand all Loading... |
259 Feature::ScopedCurrentChannel sc(chrome::VersionInfo::CHANNEL_DEV); | 257 Feature::ScopedCurrentChannel sc(chrome::VersionInfo::CHANNEL_DEV); |
260 // Test HTML form POST data access with the multipart and plaintext encoding. | 258 // Test HTML form POST data access with the multipart and plaintext encoding. |
261 ASSERT_TRUE(RunExtensionSubtest("webrequest", "test_post2.html")) << | 259 ASSERT_TRUE(RunExtensionSubtest("webrequest", "test_post2.html")) << |
262 message_; | 260 message_; |
263 } | 261 } |
264 | 262 |
265 IN_PROC_BROWSER_TEST_F(ExtensionWebRequestApiTest, | 263 IN_PROC_BROWSER_TEST_F(ExtensionWebRequestApiTest, |
266 DeclarativeSendMessage) { | 264 DeclarativeSendMessage) { |
267 ASSERT_TRUE(RunExtensionTest("webrequest_sendmessage")) << message_; | 265 ASSERT_TRUE(RunExtensionTest("webrequest_sendmessage")) << message_; |
268 } | 266 } |
OLD | NEW |