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

Side by Side Diff: chrome/common/extensions/extension_manifests_unittest.cc

Issue 6879077: Make sure that extensions can launch web urls with web safe schemes only. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/file_path.h" 6 #include "base/file_path.h"
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "base/string_number_conversions.h" 10 #include "base/string_number_conversions.h"
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 errors::kInvalidLaunchHeight); 249 errors::kInvalidLaunchHeight);
250 } 250 }
251 251
252 TEST_F(ExtensionManifestTest, AppLaunchURL) { 252 TEST_F(ExtensionManifestTest, AppLaunchURL) {
253 LoadAndExpectError("launch_path_and_url.json", 253 LoadAndExpectError("launch_path_and_url.json",
254 errors::kLaunchPathAndURLAreExclusive); 254 errors::kLaunchPathAndURLAreExclusive);
255 LoadAndExpectError("launch_path_invalid_type.json", 255 LoadAndExpectError("launch_path_invalid_type.json",
256 errors::kInvalidLaunchLocalPath); 256 errors::kInvalidLaunchLocalPath);
257 LoadAndExpectError("launch_path_invalid_value.json", 257 LoadAndExpectError("launch_path_invalid_value.json",
258 errors::kInvalidLaunchLocalPath); 258 errors::kInvalidLaunchLocalPath);
259 LoadAndExpectError("launch_url_invalid_type.json", 259 LoadAndExpectError("launch_url_invalid_type_1.json",
260 errors::kInvalidLaunchWebURL);
261 LoadAndExpectError("launch_url_invalid_type_2.json",
262 errors::kInvalidLaunchWebURL);
263 LoadAndExpectError("launch_url_invalid_type_3.json",
260 errors::kInvalidLaunchWebURL); 264 errors::kInvalidLaunchWebURL);
261 265
262 scoped_refptr<Extension> extension; 266 scoped_refptr<Extension> extension;
263 extension = LoadAndExpectSuccess("launch_local_path.json"); 267 extension = LoadAndExpectSuccess("launch_local_path.json");
264 EXPECT_EQ(extension->url().spec() + "launch.html", 268 EXPECT_EQ(extension->url().spec() + "launch.html",
265 extension->GetFullLaunchURL().spec()); 269 extension->GetFullLaunchURL().spec());
266 270
267 LoadAndExpectError("launch_web_url_relative.json", 271 LoadAndExpectError("launch_web_url_relative.json",
268 errors::kInvalidLaunchWebURL); 272 errors::kInvalidLaunchWebURL);
269 273
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
598 ASSERT_EQ(extension->file_browser_handlers()->size(), 1U); 602 ASSERT_EQ(extension->file_browser_handlers()->size(), 1U);
599 const FileBrowserHandler* action = 603 const FileBrowserHandler* action =
600 extension->file_browser_handlers()->at(0).get(); 604 extension->file_browser_handlers()->at(0).get();
601 EXPECT_EQ(action->title(), "Default title"); 605 EXPECT_EQ(action->title(), "Default title");
602 EXPECT_EQ(action->icon_path(), "icon.png"); 606 EXPECT_EQ(action->icon_path(), "icon.png");
603 const FileBrowserHandler::PatternList& patterns = action->file_url_patterns(); 607 const FileBrowserHandler::PatternList& patterns = action->file_url_patterns();
604 ASSERT_EQ(patterns.size(), 1U); 608 ASSERT_EQ(patterns.size(), 1U);
605 ASSERT_TRUE(action->MatchesURL( 609 ASSERT_TRUE(action->MatchesURL(
606 GURL("filesystem:chrome-extension://foo/local/test.txt"))); 610 GURL("filesystem:chrome-extension://foo/local/test.txt")));
607 } 611 }
OLDNEW
« no previous file with comments | « chrome/common/extensions/extension.cc ('k') | chrome/test/data/extensions/manifest_tests/launch_url_invalid_type.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698