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

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

Issue 2835233002: Fix integration tests in src/chrome and src/extensions so that we can turn on IO thread checks wi... (Closed)
Patch Set: ready for review Created 3 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
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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 ui_test_utils::NavigateToURL(browser(), non_existent_extension); 70 ui_test_utils::NavigateToURL(browser(), non_existent_extension);
71 ASSERT_TRUE(content::ExecuteScriptAndExtractString( 71 ASSERT_TRUE(content::ExecuteScriptAndExtractString(
72 browser()->tab_strip_model()->GetActiveWebContents(), 72 browser()->tab_strip_model()->GetActiveWebContents(),
73 "window.domAutomationController.send(document.title)", 73 "window.domAutomationController.send(document.title)",
74 &result)); 74 &result));
75 EXPECT_EQ(result, "Image failed to load"); 75 EXPECT_EQ(result, "Image failed to load");
76 76
77 // A data URL. Data URLs should always be able to load chrome-extension:// 77 // A data URL. Data URLs should always be able to load chrome-extension://
78 // resources. 78 // resources.
79 std::string file_source; 79 std::string file_source;
80 ASSERT_TRUE(base::ReadFileToString( 80 {
81 test_data_dir_.AppendASCII("extension_resource_request_policy") 81 base::ThreadRestrictions::ScopedAllowIO allow_io;
82 .AppendASCII("index.html"), &file_source)); 82 ASSERT_TRUE(base::ReadFileToString(
83 test_data_dir_.AppendASCII("extension_resource_request_policy")
84 .AppendASCII("index.html"),
85 &file_source));
86 }
83 ui_test_utils::NavigateToURL(browser(), 87 ui_test_utils::NavigateToURL(browser(),
84 GURL(std::string("data:text/html;charset=utf-8,") + file_source)); 88 GURL(std::string("data:text/html;charset=utf-8,") + file_source));
85 ASSERT_TRUE(content::ExecuteScriptAndExtractString( 89 ASSERT_TRUE(content::ExecuteScriptAndExtractString(
86 browser()->tab_strip_model()->GetActiveWebContents(), 90 browser()->tab_strip_model()->GetActiveWebContents(),
87 "window.domAutomationController.send(document.title)", 91 "window.domAutomationController.send(document.title)",
88 &result)); 92 &result));
89 EXPECT_EQ(result, "Loaded"); 93 EXPECT_EQ(result, "Loaded");
90 94
91 // A different extension. Legacy (manifest_version 1) extensions should always 95 // A different extension. Legacy (manifest_version 1) extensions should always
92 // be able to load each other's resources. 96 // be able to load each other's resources.
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 // The iframe should not load |private_page|, which is not web-accessible. 350 // The iframe should not load |private_page|, which is not web-accessible.
347 // 351 //
348 // TODO(alexmos): The failure mode differs on whether or not 352 // TODO(alexmos): The failure mode differs on whether or not
349 // --isolate-extensions is used: if it is on, the request is canceled and we 353 // --isolate-extensions is used: if it is on, the request is canceled and we
350 // stay on public.html (see https://crbug.com/656752), and if it's off, the 354 // stay on public.html (see https://crbug.com/656752), and if it's off, the
351 // request is blocked in ExtensionNavigationThrottle, which loads an error 355 // request is blocked in ExtensionNavigationThrottle, which loads an error
352 // page into the iframe. This check handles both cases, but we should make 356 // page into the iframe. This check handles both cases, but we should make
353 // the check stricter once --isolate-extensions is on by default. 357 // the check stricter once --isolate-extensions is on by default.
354 EXPECT_NE("Private", content); 358 EXPECT_NE("Private", content);
355 } 359 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_keybinding_apitest.cc ('k') | chrome/browser/extensions/extension_webui_apitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698