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 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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::ExecuteJavaScriptAndExtractString( |
195 tab->GetRenderViewHost(), L"", | 195 tab->GetRenderViewHost(), |
196 L"window.domAutomationController.send(document.body.textContent)", | 196 "", |
| 197 "window.domAutomationController.send(document.body.textContent)", |
197 &body)); | 198 &body)); |
198 EXPECT_EQ(expected_content_regular_window, body); | 199 EXPECT_EQ(expected_content_regular_window, body); |
199 | 200 |
200 // Test that navigation in OTR window is properly redirected. | 201 // Test that navigation in OTR window is properly redirected. |
201 Browser* otr_browser = ui_test_utils::OpenURLOffTheRecord( | 202 Browser* otr_browser = ui_test_utils::OpenURLOffTheRecord( |
202 browser()->profile(), GURL("about:blank")); | 203 browser()->profile(), GURL("about:blank")); |
203 | 204 |
204 if (wait_for_extension_loaded_in_incognito) | 205 if (wait_for_extension_loaded_in_incognito) |
205 EXPECT_TRUE(listener_incognito.WaitUntilSatisfied()); | 206 EXPECT_TRUE(listener_incognito.WaitUntilSatisfied()); |
206 | 207 |
207 // This navigation should be redirected if | 208 // This navigation should be redirected if |
208 // load_extension_with_incognito_permission is true. | 209 // load_extension_with_incognito_permission is true. |
209 ui_test_utils::NavigateToURL( | 210 ui_test_utils::NavigateToURL( |
210 otr_browser, | 211 otr_browser, |
211 test_server()->GetURL("files/extensions/test_file.html")); | 212 test_server()->GetURL("files/extensions/test_file.html")); |
212 | 213 |
213 body.clear(); | 214 body.clear(); |
214 WebContents* otr_tab = chrome::GetActiveWebContents(otr_browser); | 215 WebContents* otr_tab = chrome::GetActiveWebContents(otr_browser); |
215 ASSERT_TRUE(content::ExecuteJavaScriptAndExtractString( | 216 ASSERT_TRUE(content::ExecuteJavaScriptAndExtractString( |
216 otr_tab->GetRenderViewHost(), L"", | 217 otr_tab->GetRenderViewHost(), |
217 L"window.domAutomationController.send(document.body.textContent)", | 218 "", |
| 219 "window.domAutomationController.send(document.body.textContent)", |
218 &body)); | 220 &body)); |
219 EXPECT_EQ(exptected_content_incognito_window, body); | 221 EXPECT_EQ(exptected_content_incognito_window, body); |
220 } | 222 } |
221 | 223 |
222 IN_PROC_BROWSER_TEST_F(ExtensionWebRequestApiTest, | 224 IN_PROC_BROWSER_TEST_F(ExtensionWebRequestApiTest, |
223 WebRequestDeclarativePermissionSpanning1) { | 225 WebRequestDeclarativePermissionSpanning1) { |
224 // Test spanning with incognito permission. | 226 // Test spanning with incognito permission. |
225 RunPermissionTest("spanning", true, false, "redirected1", "redirected1"); | 227 RunPermissionTest("spanning", true, false, "redirected1", "redirected1"); |
226 } | 228 } |
227 | 229 |
(...skipping 29 matching lines...) Expand all Loading... |
257 Feature::ScopedCurrentChannel sc(chrome::VersionInfo::CHANNEL_DEV); | 259 Feature::ScopedCurrentChannel sc(chrome::VersionInfo::CHANNEL_DEV); |
258 // Test HTML form POST data access with the multipart and plaintext encoding. | 260 // Test HTML form POST data access with the multipart and plaintext encoding. |
259 ASSERT_TRUE(RunExtensionSubtest("webrequest", "test_post2.html")) << | 261 ASSERT_TRUE(RunExtensionSubtest("webrequest", "test_post2.html")) << |
260 message_; | 262 message_; |
261 } | 263 } |
262 | 264 |
263 IN_PROC_BROWSER_TEST_F(ExtensionWebRequestApiTest, | 265 IN_PROC_BROWSER_TEST_F(ExtensionWebRequestApiTest, |
264 DeclarativeSendMessage) { | 266 DeclarativeSendMessage) { |
265 ASSERT_TRUE(RunExtensionTest("webrequest_sendmessage")) << message_; | 267 ASSERT_TRUE(RunExtensionTest("webrequest_sendmessage")) << message_; |
266 } | 268 } |
OLD | NEW |