| OLD | NEW |
| 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 "chrome/common/extensions/extension.h" | 5 #include "chrome/common/extensions/extension.h" |
| 6 | 6 |
| 7 #include "base/format_macros.h" | 7 #include "base/format_macros.h" |
| 8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 544 extension->HasAPIPermission(kTests[i].permission_name)) | 544 extension->HasAPIPermission(kTests[i].permission_name)) |
| 545 << "Permission being tested: " << kTests[i].permission_name; | 545 << "Permission being tested: " << kTests[i].permission_name; |
| 546 } | 546 } |
| 547 } | 547 } |
| 548 | 548 |
| 549 TEST(ExtensionTest, GetHostPermissionMessages_ManyHosts) { | 549 TEST(ExtensionTest, GetHostPermissionMessages_ManyHosts) { |
| 550 scoped_refptr<Extension> extension; | 550 scoped_refptr<Extension> extension; |
| 551 extension = LoadManifest("permissions", "many-hosts.json"); | 551 extension = LoadManifest("permissions", "many-hosts.json"); |
| 552 std::vector<string16> warnings = extension->GetPermissionMessageStrings(); | 552 std::vector<string16> warnings = extension->GetPermissionMessageStrings(); |
| 553 ASSERT_EQ(1u, warnings.size()); | 553 ASSERT_EQ(1u, warnings.size()); |
| 554 EXPECT_EQ("Your data on www.google.com and encrypted.google.com", | 554 EXPECT_EQ("Your data on encrypted.google.com and www.google.com", |
| 555 UTF16ToUTF8(warnings[0])); | 555 UTF16ToUTF8(warnings[0])); |
| 556 } | 556 } |
| 557 | 557 |
| 558 TEST(ExtensionTest, GetPermissionMessages_Plugins) { | 558 TEST(ExtensionTest, GetPermissionMessages_Plugins) { |
| 559 scoped_refptr<Extension> extension; | 559 scoped_refptr<Extension> extension; |
| 560 extension = LoadManifest("permissions", "plugins.json"); | 560 extension = LoadManifest("permissions", "plugins.json"); |
| 561 std::vector<string16> warnings = extension->GetPermissionMessageStrings(); | 561 std::vector<string16> warnings = extension->GetPermissionMessageStrings(); |
| 562 // We don't parse the plugins key on Chrome OS, so it should not ask for any | 562 // We don't parse the plugins key on Chrome OS, so it should not ask for any |
| 563 // permissions. | 563 // permissions. |
| 564 #if defined(OS_CHROMEOS) | 564 #if defined(OS_CHROMEOS) |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 765 EXPECT_TRUE(Extension::GenerateId("test", &result)); | 765 EXPECT_TRUE(Extension::GenerateId("test", &result)); |
| 766 EXPECT_EQ(result, "jpignaibiiemhngfjkcpokkamffknabf"); | 766 EXPECT_EQ(result, "jpignaibiiemhngfjkcpokkamffknabf"); |
| 767 | 767 |
| 768 EXPECT_TRUE(Extension::GenerateId("_", &result)); | 768 EXPECT_TRUE(Extension::GenerateId("_", &result)); |
| 769 EXPECT_EQ(result, "ncocknphbhhlhkikpnnlmbcnbgdempcd"); | 769 EXPECT_EQ(result, "ncocknphbhhlhkikpnnlmbcnbgdempcd"); |
| 770 | 770 |
| 771 EXPECT_TRUE(Extension::GenerateId( | 771 EXPECT_TRUE(Extension::GenerateId( |
| 772 "this_string_is_longer_than_a_single_sha256_hash_digest", &result)); | 772 "this_string_is_longer_than_a_single_sha256_hash_digest", &result)); |
| 773 EXPECT_EQ(result, "jimneklojkjdibfkgiiophfhjhbdgcfi"); | 773 EXPECT_EQ(result, "jimneklojkjdibfkgiiophfhjhbdgcfi"); |
| 774 } | 774 } |
| OLD | NEW |