Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/path_service.h" | 8 #include "base/path_service.h" |
| 9 #include "base/scoped_ptr.h" | 9 #include "base/scoped_ptr.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 301 ASSERT_TRUE(manifest.get()); | 301 ASSERT_TRUE(manifest.get()); |
| 302 | 302 |
| 303 ListValue *permissions = new ListValue(); | 303 ListValue *permissions = new ListValue(); |
| 304 manifest->Set(keys::kPermissions, permissions); | 304 manifest->Set(keys::kPermissions, permissions); |
| 305 for (size_t i = 0; i < Extension::kNumPermissions; i++) { | 305 for (size_t i = 0; i < Extension::kNumPermissions; i++) { |
| 306 const char* name = Extension::kPermissions[i].name; | 306 const char* name = Extension::kPermissions[i].name; |
| 307 StringValue* p = new StringValue(name); | 307 StringValue* p = new StringValue(name); |
| 308 permissions->Clear(); | 308 permissions->Clear(); |
| 309 permissions->Append(p); | 309 permissions->Append(p); |
| 310 std::string message_name = base::StringPrintf("permission-%s", name); | 310 std::string message_name = base::StringPrintf("permission-%s", name); |
| 311 if (Extension::IsHostedAppPermission(name)) { | 311 |
| 312 scoped_refptr<Extension> extension; | 312 // Since we no longer throw errors when permissions aren't recognized, |
| 313 extension = LoadAndExpectSuccess(manifest.get(), message_name); | 313 // the extension should successfully load for any of these. |
|
Aaron Boodman
2010/11/12 00:05:24
This comment seems kinda cryptic. How about renami
jstritar
2010/11/19 21:38:36
I renamed the test and updated the comment.
As fo
| |
| 314 } else { | 314 scoped_refptr<Extension> extension; |
| 315 LoadAndExpectError(manifest.get(), message_name, | 315 extension = LoadAndExpectSuccess(manifest.get(), message_name); |
| 316 errors::kInvalidPermission); | |
| 317 } | |
| 318 } | 316 } |
| 319 } | 317 } |
| 320 | 318 |
| 321 TEST_F(ExtensionManifestTest, NormalizeIconPaths) { | 319 TEST_F(ExtensionManifestTest, NormalizeIconPaths) { |
| 322 scoped_refptr<Extension> extension( | 320 scoped_refptr<Extension> extension( |
| 323 LoadAndExpectSuccess("normalize_icon_paths.json")); | 321 LoadAndExpectSuccess("normalize_icon_paths.json")); |
| 324 EXPECT_EQ("16.png", | 322 EXPECT_EQ("16.png", |
| 325 extension->icons().Get(16, ExtensionIconSet::MATCH_EXACTLY)); | 323 extension->icons().Get(16, ExtensionIconSet::MATCH_EXACTLY)); |
| 326 EXPECT_EQ("48.png", | 324 EXPECT_EQ("48.png", |
| 327 extension->icons().Get(48, ExtensionIconSet::MATCH_EXACTLY)); | 325 extension->icons().Get(48, ExtensionIconSet::MATCH_EXACTLY)); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 360 | 358 |
| 361 TEST_F(ExtensionManifestTest, DefaultPathForExtent) { | 359 TEST_F(ExtensionManifestTest, DefaultPathForExtent) { |
| 362 scoped_refptr<Extension> extension( | 360 scoped_refptr<Extension> extension( |
| 363 LoadAndExpectSuccess("default_path_for_extent.json")); | 361 LoadAndExpectSuccess("default_path_for_extent.json")); |
| 364 | 362 |
| 365 ASSERT_EQ(1u, extension->web_extent().patterns().size()); | 363 ASSERT_EQ(1u, extension->web_extent().patterns().size()); |
| 366 EXPECT_EQ("/*", extension->web_extent().patterns()[0].path()); | 364 EXPECT_EQ("/*", extension->web_extent().patterns()[0].path()); |
| 367 EXPECT_TRUE(extension->web_extent().ContainsURL( | 365 EXPECT_TRUE(extension->web_extent().ContainsURL( |
| 368 GURL("http://www.google.com/monkey"))); | 366 GURL("http://www.google.com/monkey"))); |
| 369 } | 367 } |
| OLD | NEW |