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

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

Issue 9909019: Add schema chrome-extension-resource:// for extension resources (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Make some test flaky for OSX Created 8 years, 7 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/logging.h" 5 #include "base/logging.h"
6 #include "chrome/browser/extensions/extension_apitest.h" 6 #include "chrome/browser/extensions/extension_apitest.h"
7 #include "chrome/browser/ui/browser.h" 7 #include "chrome/browser/ui/browser.h"
8 #include "chrome/common/chrome_switches.h" 8 #include "chrome/common/chrome_switches.h"
9 #include "chrome/test/base/ui_test_utils.h" 9 #include "chrome/test/base/ui_test_utils.h"
10 #include "content/public/browser/web_contents.h" 10 #include "content/public/browser/web_contents.h"
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 GURL nonexistent_resource( 186 GURL nonexistent_resource(
187 test_server()->GetURL( 187 test_server()->GetURL(
188 "files/extensions/api_test/extension_resource_request_policy/" 188 "files/extensions/api_test/extension_resource_request_policy/"
189 "web_accessible/nonexistent_resource.html")); 189 "web_accessible/nonexistent_resource.html"));
190 ui_test_utils::NavigateToURL(browser(), nonexistent_resource); 190 ui_test_utils::NavigateToURL(browser(), nonexistent_resource);
191 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractString( 191 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractString(
192 browser()->GetSelectedWebContents()->GetRenderViewHost(), L"", 192 browser()->GetSelectedWebContents()->GetRenderViewHost(), L"",
193 L"window.domAutomationController.send(document.title)", 193 L"window.domAutomationController.send(document.title)",
194 &result)); 194 &result));
195 EXPECT_EQ("Image failed to load", result); 195 EXPECT_EQ("Image failed to load", result);
196
197 GURL nonaccessible_cer_resource(
198 test_server()->GetURL(
199 "files/extensions/api_test/extension_resource_request_policy/"
200 "web_accessible/nonaccessible_chrome_resource_scheme.html"));
201 ui_test_utils::NavigateToURL(browser(), nonaccessible_cer_resource);
202 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractString(
203 browser()->GetSelectedWebContents()->GetRenderViewHost(), L"",
204 L"window.domAutomationController.send(document.title)",
205 &result));
206 EXPECT_EQ("Loading CER:// failed.", result);
196 } 207 }
197 208
198 IN_PROC_BROWSER_TEST_F(ExtensionResourceRequestPolicyTest, Iframe) { 209 IN_PROC_BROWSER_TEST_F(ExtensionResourceRequestPolicyTest, Iframe) {
199 // Load another extension, which the test one shouldn't be able to get 210 // Load another extension, which the test one shouldn't be able to get
200 // resources from. 211 // resources from.
201 ASSERT_TRUE(LoadExtension(test_data_dir_ 212 ASSERT_TRUE(LoadExtension(test_data_dir_
202 .AppendASCII("extension_resource_request_policy") 213 .AppendASCII("extension_resource_request_policy")
203 .AppendASCII("inaccessible"))); 214 .AppendASCII("inaccessible")));
204 EXPECT_TRUE(RunExtensionSubtest( 215 EXPECT_TRUE(RunExtensionSubtest(
205 "extension_resource_request_policy/web_accessible", 216 "extension_resource_request_policy/web_accessible",
206 "iframe.html")); 217 "iframe.html"));
207 } 218 }
219
220 #if defined(OS_MACOSX)
221 #define MAYBE_ExtensionAccessibleResources FLAKY_ExtensionAccessibleResources
222 #else
223 #define MAYBE_ExtensionAccessibleResources ExtensionAccessibleResources
224 #endif
225 IN_PROC_BROWSER_TEST_F(ExtensionResourceRequestPolicyTest,
226 MAYBE_ExtensionAccessibleResources) {
227 ASSERT_TRUE(RunExtensionSubtest("accessible_cer", "main.html")) << message_;
228 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_resource_protocols.cc ('k') | chrome/browser/profiles/profile_io_data.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698