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

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

Issue 10828067: Extension resources should only load in contexts the extension has permission to access. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Line endings. How I hate them. Created 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/common/extensions/extension.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/browser/ui/browser_tabstrip.h" 8 #include "chrome/browser/ui/browser_tabstrip.h"
9 #include "chrome/common/chrome_switches.h" 9 #include "chrome/common/chrome_switches.h"
10 #include "chrome/test/base/ui_test_utils.h" 10 #include "chrome/test/base/ui_test_utils.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 // A web host that has permission. 47 // A web host that has permission.
48 ui_test_utils::NavigateToURL( 48 ui_test_utils::NavigateToURL(
49 browser(), web_resource.ReplaceComponents(make_host_a_com)); 49 browser(), web_resource.ReplaceComponents(make_host_a_com));
50 std::string result; 50 std::string result;
51 ASSERT_TRUE(content::ExecuteJavaScriptAndExtractString( 51 ASSERT_TRUE(content::ExecuteJavaScriptAndExtractString(
52 chrome::GetActiveWebContents(browser())->GetRenderViewHost(), L"", 52 chrome::GetActiveWebContents(browser())->GetRenderViewHost(), L"",
53 L"window.domAutomationController.send(document.title)", 53 L"window.domAutomationController.send(document.title)",
54 &result)); 54 &result));
55 EXPECT_EQ(result, "Loaded"); 55 EXPECT_EQ(result, "Loaded");
56 56
57 // A web host that does not have permission.
58 ui_test_utils::NavigateToURL(
59 browser(), web_resource.ReplaceComponents(make_host_b_com));
60 ASSERT_TRUE(content::ExecuteJavaScriptAndExtractString(
61 chrome::GetActiveWebContents(browser())->GetRenderViewHost(), L"",
62 L"window.domAutomationController.send(document.title)",
63 &result));
64 EXPECT_EQ(result, "Image failed to load");
65
57 // A web host that loads a non-existent extension. 66 // A web host that loads a non-existent extension.
58 GURL non_existent_extension( 67 GURL non_existent_extension(
59 test_server()->GetURL( 68 test_server()->GetURL(
60 "files/extensions/api_test/extension_resource_request_policy/" 69 "files/extensions/api_test/extension_resource_request_policy/"
61 "non_existent_extension.html")); 70 "non_existent_extension.html"));
62 ui_test_utils::NavigateToURL(browser(), non_existent_extension); 71 ui_test_utils::NavigateToURL(browser(), non_existent_extension);
63 ASSERT_TRUE(content::ExecuteJavaScriptAndExtractString( 72 ASSERT_TRUE(content::ExecuteJavaScriptAndExtractString(
64 chrome::GetActiveWebContents(browser())->GetRenderViewHost(), L"", 73 chrome::GetActiveWebContents(browser())->GetRenderViewHost(), L"",
65 L"window.domAutomationController.send(document.title)", 74 L"window.domAutomationController.send(document.title)",
66 &result)); 75 &result));
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 230
222 #if defined(OS_MACOSX) 231 #if defined(OS_MACOSX)
223 #define MAYBE_ExtensionAccessibleResources FLAKY_ExtensionAccessibleResources 232 #define MAYBE_ExtensionAccessibleResources FLAKY_ExtensionAccessibleResources
224 #else 233 #else
225 #define MAYBE_ExtensionAccessibleResources ExtensionAccessibleResources 234 #define MAYBE_ExtensionAccessibleResources ExtensionAccessibleResources
226 #endif 235 #endif
227 IN_PROC_BROWSER_TEST_F(ExtensionResourceRequestPolicyTest, 236 IN_PROC_BROWSER_TEST_F(ExtensionResourceRequestPolicyTest,
228 MAYBE_ExtensionAccessibleResources) { 237 MAYBE_ExtensionAccessibleResources) {
229 ASSERT_TRUE(RunExtensionSubtest("accessible_cer", "main.html")) << message_; 238 ASSERT_TRUE(RunExtensionSubtest("accessible_cer", "main.html")) << message_;
230 } 239 }
OLDNEW
« no previous file with comments | « no previous file | chrome/common/extensions/extension.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698