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

Side by Side Diff: chrome/browser/extensions/extension_resource_request_policy_apitest.cc

Issue 2013573007: Catch CSP violations in InProcessBrowserTest Base URL: https://chromium.googlesource.com/a/chromium/src.git@master
Patch Set: double check test is run Created 4 years, 4 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
OLDNEW
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 "base/logging.h" 6 #include "base/logging.h"
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 #include "chrome/browser/extensions/extension_apitest.h" 8 #include "chrome/browser/extensions/extension_apitest.h"
9 #include "chrome/browser/ui/browser.h" 9 #include "chrome/browser/ui/browser.h"
10 #include "chrome/browser/ui/tabs/tab_strip_model.h" 10 #include "chrome/browser/ui/tabs/tab_strip_model.h"
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 294
295 GURL accessible_resource_with_csp(embedded_test_server()->GetURL( 295 GURL accessible_resource_with_csp(embedded_test_server()->GetURL(
296 "/extensions/api_test/extension_resource_request_policy/" 296 "/extensions/api_test/extension_resource_request_policy/"
297 "web_accessible/accessible_resource_with_csp.html")); 297 "web_accessible/accessible_resource_with_csp.html"));
298 ui_test_utils::NavigateToURL(browser(), accessible_resource_with_csp); 298 ui_test_utils::NavigateToURL(browser(), accessible_resource_with_csp);
299 ASSERT_TRUE(content::ExecuteScriptAndExtractString( 299 ASSERT_TRUE(content::ExecuteScriptAndExtractString(
300 browser()->tab_strip_model()->GetActiveWebContents(), 300 browser()->tab_strip_model()->GetActiveWebContents(),
301 "window.domAutomationController.send(document.title)", 301 "window.domAutomationController.send(document.title)",
302 &result)); 302 &result));
303 EXPECT_EQ("Loaded", result); 303 EXPECT_EQ("Loaded", result);
304 // The violation is not intentional. See crbug.com/616181
305 SetExpectCSPErrorMessages(true);
304 } 306 }
305 307
306 IN_PROC_BROWSER_TEST_F(ExtensionResourceRequestPolicyTest, Iframe) { 308 IN_PROC_BROWSER_TEST_F(ExtensionResourceRequestPolicyTest, Iframe) {
307 // Load another extension, which the test one shouldn't be able to get 309 // Load another extension, which the test one shouldn't be able to get
308 // resources from. 310 // resources from.
309 ASSERT_TRUE(LoadExtension(test_data_dir_ 311 ASSERT_TRUE(LoadExtension(test_data_dir_
310 .AppendASCII("extension_resource_request_policy") 312 .AppendASCII("extension_resource_request_policy")
311 .AppendASCII("inaccessible"))); 313 .AppendASCII("inaccessible")));
312 EXPECT_TRUE(RunExtensionSubtest( 314 EXPECT_TRUE(RunExtensionSubtest(
313 "extension_resource_request_policy/web_accessible", 315 "extension_resource_request_policy/web_accessible",
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 374
373 content::WebContents* web_contents = 375 content::WebContents* web_contents =
374 browser()->tab_strip_model()->GetActiveWebContents(); 376 browser()->tab_strip_model()->GetActiveWebContents();
375 377
376 GURL private_page( 378 GURL private_page(
377 "chrome-extension://kegmjfcnjamahdnldjmlpachmpielcdk/private.html"); 379 "chrome-extension://kegmjfcnjamahdnldjmlpachmpielcdk/private.html");
378 NavigationErrorObserver observer(web_contents, private_page); 380 NavigationErrorObserver observer(web_contents, private_page);
379 ASSERT_TRUE(content::ExecuteScript(web_contents, "navigateFrameNow()")); 381 ASSERT_TRUE(content::ExecuteScript(web_contents, "navigateFrameNow()"));
380 observer.Wait(); 382 observer.Wait();
381 } 383 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/content_security_policy_apitest.cc ('k') | chrome/browser/translate/translate_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698