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

Side by Side Diff: chrome/browser/extensions/api/webstore_private/webstore_private_apitest.cc

Issue 10959032: Protect the entire webstore origin, not just the webstore path, with XFO. Follow-up to crrev.com/1… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 3 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/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc » ('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 <vector> 5 #include <vector>
6 6
7 #include "base/file_path.h" 7 #include "base/file_path.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/stringprintf.h" 9 #include "base/stringprintf.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 }; 89 };
90 90
91 } // namespace 91 } // namespace
92 92
93 // A base class for tests below. 93 // A base class for tests below.
94 class ExtensionWebstorePrivateApiTest : public ExtensionApiTest { 94 class ExtensionWebstorePrivateApiTest : public ExtensionApiTest {
95 public: 95 public:
96 void SetUpCommandLine(CommandLine* command_line) OVERRIDE { 96 void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
97 ExtensionApiTest::SetUpCommandLine(command_line); 97 ExtensionApiTest::SetUpCommandLine(command_line);
98 command_line->AppendSwitchASCII( 98 command_line->AppendSwitchASCII(
99 switches::kAppsGalleryURL, "http://www.example.com"); 99 switches::kAppsGalleryURL,
100 "http://www.example.com/files/extensions/api_test");
100 command_line->AppendSwitchASCII( 101 command_line->AppendSwitchASCII(
101 switches::kAppsGalleryInstallAutoConfirmForTests, "accept"); 102 switches::kAppsGalleryInstallAutoConfirmForTests, "accept");
102 } 103 }
103 104
104 void SetUpInProcessBrowserTestFixture() OVERRIDE { 105 void SetUpInProcessBrowserTestFixture() OVERRIDE {
105 // Start up the test server and get us ready for calling the install 106 // Start up the test server and get us ready for calling the install
106 // API functions. 107 // API functions.
107 host_resolver()->AddRule("www.example.com", "127.0.0.1"); 108 host_resolver()->AddRule("www.example.com", "127.0.0.1");
108 ASSERT_TRUE(test_server()->Start()); 109 ASSERT_TRUE(test_server()->Start());
109 ExtensionInstallUI::DisableFailureUIForTests(); 110 ExtensionInstallUI::DisableFailureUIForTests();
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 function.get(), kEmptyArgs, browser())); 255 function.get(), kEmptyArgs, browser()));
255 EXPECT_EQ(base::Value::TYPE_STRING, result->GetType()); 256 EXPECT_EQ(base::Value::TYPE_STRING, result->GetType());
256 StringValue* value = static_cast<StringValue*>(result.get()); 257 StringValue* value = static_cast<StringValue*>(result.get());
257 std::string webgl_status = ""; 258 std::string webgl_status = "";
258 EXPECT_TRUE(value && value->GetAsString(&webgl_status)); 259 EXPECT_TRUE(value && value->GetAsString(&webgl_status));
259 EXPECT_STREQ(webgl_allowed ? kWebGLStatusAllowed : kWebGLStatusBlocked, 260 EXPECT_STREQ(webgl_allowed ? kWebGLStatusAllowed : kWebGLStatusBlocked,
260 webgl_status.c_str()); 261 webgl_status.c_str());
261 } 262 }
262 }; 263 };
263 264
264 // Test case for webstore origin frame blocking. 265 // Test cases for webstore origin frame blocking.
265 IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateApiTest, FLAKY_FrameBlocked) { 266 IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateApiTest,
267 FrameWebstorePageBlocked) {
266 content::WebContents* contents = chrome::GetActiveWebContents(browser()); 268 content::WebContents* contents = chrome::GetActiveWebContents(browser());
267 string16 expected_title = UTF8ToUTF16("PASS: about:blank"); 269 string16 expected_title = UTF8ToUTF16("PASS: about:blank");
268 string16 failure_title = UTF8ToUTF16("FAIL"); 270 string16 failure_title = UTF8ToUTF16("FAIL");
269 content::TitleWatcher watcher(contents, expected_title); 271 content::TitleWatcher watcher(contents, expected_title);
270 watcher.AlsoWaitForTitle(failure_title); 272 watcher.AlsoWaitForTitle(failure_title);
271 GURL url = test_server()->GetURL( 273 GURL url = test_server()->GetURL(
272 "files/extensions/api_test/webstore_private/noframe.html"); 274 "files/extensions/api_test/webstore_private/noframe.html");
273 ui_test_utils::NavigateToURL(browser(), url); 275 ui_test_utils::NavigateToURL(browser(), url);
274 string16 final_title = watcher.WaitAndGetTitle(); 276 string16 final_title = watcher.WaitAndGetTitle();
275 EXPECT_EQ(expected_title, final_title); 277 EXPECT_EQ(expected_title, final_title);
276 } 278 }
277 279
280 IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateApiTest,
281 FrameErrorPageBlocked) {
282 content::WebContents* contents = chrome::GetActiveWebContents(browser());
283 string16 expected_title = UTF8ToUTF16("PASS: about:blank");
284 string16 failure_title = UTF8ToUTF16("FAIL");
285 content::TitleWatcher watcher(contents, expected_title);
286 watcher.AlsoWaitForTitle(failure_title);
287 GURL url = test_server()->GetURL(
288 "files/extensions/api_test/webstore_private/noframe2.html");
289 ui_test_utils::NavigateToURL(browser(), url);
290 string16 final_title = watcher.WaitAndGetTitle();
291 EXPECT_EQ(expected_title, final_title);
292 }
293
278 // Test cases where the user accepts the install confirmation dialog. 294 // Test cases where the user accepts the install confirmation dialog.
279 IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateApiTest, InstallAccepted) { 295 IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateApiTest, InstallAccepted) {
280 ASSERT_TRUE(RunInstallTest("accepted.html", "extension.crx")); 296 ASSERT_TRUE(RunInstallTest("accepted.html", "extension.crx"));
281 } 297 }
282 298
283 // Test having the default download directory missing. 299 // Test having the default download directory missing.
284 IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateApiTest, MissingDownloadDir) { 300 IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateApiTest, MissingDownloadDir) {
285 // Set a non-existent directory as the download path. 301 // Set a non-existent directory as the download path.
286 ScopedTempDir temp_dir; 302 ScopedTempDir temp_dir;
287 EXPECT_TRUE(temp_dir.CreateUniqueTempDir()); 303 EXPECT_TRUE(temp_dir.CreateUniqueTempDir());
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 json_blacklist, gpu_info); 469 json_blacklist, gpu_info);
454 GpuFeatureType type = 470 GpuFeatureType type =
455 content::GpuDataManager::GetInstance()->GetBlacklistedFeatures(); 471 content::GpuDataManager::GetInstance()->GetBlacklistedFeatures();
456 EXPECT_EQ(type, content::GPU_FEATURE_TYPE_WEBGL); 472 EXPECT_EQ(type, content::GPU_FEATURE_TYPE_WEBGL);
457 473
458 bool webgl_allowed = false; 474 bool webgl_allowed = false;
459 RunTest(webgl_allowed); 475 RunTest(webgl_allowed);
460 } 476 }
461 477
462 } // namespace extensions 478 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698