summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions/extensions_service_unittest.cc
diff options
context:
space:
mode:
authoraa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-06 06:17:54 +0000
committeraa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-06 06:17:54 +0000
commit84ac7f362e565c096851a783ca7163b78e19b659 (patch)
tree7f671e9c025e4e4b37468240e9be7a28926f6a7c /chrome/browser/extensions/extensions_service_unittest.cc
parent17492f531825be1522991579c1a1bd6af2d8c4b1 (diff)
downloadchromium_src-84ac7f362e565c096851a783ca7163b78e19b659.zip
chromium_src-84ac7f362e565c096851a783ca7163b78e19b659.tar.gz
chromium_src-84ac7f362e565c096851a783ca7163b78e19b659.tar.bz2
Generate IDs for --load-extension by hashing the path instead
of incrementing a static counter. BUG=21281 TEST=Load an unpacked extension from chrome://extensions/ that does not have an ID in its manifest. The resulting ID should be random-looking, not something like "aaaaaa". Review URL: http://codereview.chromium.org/256049 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@28095 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/extensions_service_unittest.cc')
-rw-r--r--chrome/browser/extensions/extensions_service_unittest.cc19
1 files changed, 6 insertions, 13 deletions
diff --git a/chrome/browser/extensions/extensions_service_unittest.cc b/chrome/browser/extensions/extensions_service_unittest.cc
index 04ff3d7..fa257e0 100644
--- a/chrome/browser/extensions/extensions_service_unittest.cc
+++ b/chrome/browser/extensions/extensions_service_unittest.cc
@@ -1197,7 +1197,6 @@ TEST_F(ExtensionsServiceTest, LoadExtension) {
// --load-extension.
TEST_F(ExtensionsServiceTest, GenerateID) {
InitializeEmptyExtensionsService();
- Extension::ResetGeneratedIdCounter();
FilePath extensions_path;
ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &extensions_path));
@@ -1208,25 +1207,19 @@ TEST_F(ExtensionsServiceTest, GenerateID) {
loop_.RunAllPending();
EXPECT_EQ(0u, GetErrors().size());
ASSERT_EQ(1u, loaded_.size());
- std::string id1 = loaded_[0]->id();
- EXPECT_EQ(all_zero, id1);
- EXPECT_EQ("chrome-extension://aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/",
- loaded_[0]->url().spec());
+ ASSERT_TRUE(Extension::IdIsValid(loaded_[0]->id()));
EXPECT_EQ(loaded_[0]->location(), Extension::LOAD);
// --load-extension doesn't add entries to prefs
ValidatePrefKeyCount(0);
+ std::string previous_id = loaded_[0]->id();
+
+ // If we reload the same path, we should get the same extension ID.
service_->LoadExtension(no_id_ext);
loop_.RunAllPending();
- std::string id2 = loaded_[1]->id();
- EXPECT_EQ(zero_n_one, id2);
- EXPECT_EQ("chrome-extension://aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab/",
- loaded_[1]->url().spec());
- EXPECT_EQ(loaded_[1]->location(), Extension::LOAD);
-
- // --load-extension doesn't add entries to prefs
- ValidatePrefKeyCount(0);
+ ASSERT_EQ(1u, loaded_.size());
+ ASSERT_EQ(previous_id, loaded_[0]->id());
}
// Tests the external installation feature