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

Unified Diff: chrome/browser/extensions/extensions_service_unittest.cc

Issue 256049: Generate IDs for --load-extension by hashing the path instead (Closed)
Patch Set: Removed support for default Extension constructor Created 11 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/extensions_service_unittest.cc
diff --git a/chrome/browser/extensions/extensions_service_unittest.cc b/chrome/browser/extensions/extensions_service_unittest.cc
index 04ff3d7807eea3f296ca42dc7fff5f28119b851e..fa257e088e7ee82faff0ea2fea84a24729ae29ef 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
« no previous file with comments | « chrome/browser/extensions/extension_updater_unittest.cc ('k') | chrome/browser/extensions/sandboxed_extension_unpacker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698