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

Side by Side Diff: chrome/browser/extensions/extension_prefs_unittest.cc

Issue 11465016: Dedupe code in SetIdleInstallInfo(), FinishIdleInstallInfo() and OnExtensionInstalled(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix unittest. Created 8 years 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "extension_prefs_unittest.h" 5 #include "extension_prefs_unittest.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/files/scoped_temp_dir.h" 8 #include "base/files/scoped_temp_dir.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "base/prefs/public/pref_change_registrar.h" 10 #include "base/prefs/public/pref_change_registrar.h"
(...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after
601 DictionaryValue manifest; 601 DictionaryValue manifest;
602 manifest.SetString(extension_manifest_keys::kName, "test"); 602 manifest.SetString(extension_manifest_keys::kName, "test");
603 manifest.SetString(extension_manifest_keys::kVersion, 603 manifest.SetString(extension_manifest_keys::kVersion,
604 "1." + base::IntToString(num)); 604 "1." + base::IntToString(num));
605 FilePath path = prefs_.extensions_dir().AppendASCII(base::IntToString(num)); 605 FilePath path = prefs_.extensions_dir().AppendASCII(base::IntToString(num));
606 std::string errors; 606 std::string errors;
607 scoped_refptr<Extension> extension = Extension::Create( 607 scoped_refptr<Extension> extension = Extension::Create(
608 path, Extension::INTERNAL, manifest, Extension::NO_FLAGS, id, &errors); 608 path, Extension::INTERNAL, manifest, Extension::NO_FLAGS, id, &errors);
609 ASSERT_TRUE(extension) << errors; 609 ASSERT_TRUE(extension) << errors;
610 ASSERT_EQ(id, extension->id()); 610 ASSERT_EQ(id, extension->id());
611 prefs()->SetIdleInstallInfo(extension.get(), Extension::ENABLED); 611 prefs()->SetIdleInstallInfo(extension.get(), Extension::ENABLED,
612 syncer::StringOrdinal());
612 } 613 }
613 614
614 // Verifies that we get back expected idle install information previously 615 // Verifies that we get back expected idle install information previously
615 // set by SetIdleInfo. 616 // set by SetIdleInfo.
616 void VerifyIdleInfo(std::string id, int num) { 617 void VerifyIdleInfo(std::string id, int num) {
617 scoped_ptr<ExtensionInfo> info(prefs()->GetIdleInstallInfo(id)); 618 scoped_ptr<ExtensionInfo> info(prefs()->GetIdleInstallInfo(id));
618 ASSERT_TRUE(info); 619 ASSERT_TRUE(info);
619 std::string version; 620 std::string version;
620 ASSERT_TRUE(info->extension_manifest->GetString("version", &version)); 621 ASSERT_TRUE(info->extension_manifest->GetString("version", &version));
621 ASSERT_EQ("1." + base::IntToString(num), version); 622 ASSERT_EQ("1." + base::IntToString(num), version);
(...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after
1261 1262
1262 private: 1263 private:
1263 scoped_refptr<const Extension> extension_a_; 1264 scoped_refptr<const Extension> extension_a_;
1264 scoped_refptr<const Extension> extension_b_; 1265 scoped_refptr<const Extension> extension_b_;
1265 scoped_refptr<const Extension> extension_c_; 1266 scoped_refptr<const Extension> extension_c_;
1266 }; 1267 };
1267 TEST_F(ExtensionPrefsBlacklistedExtensions, 1268 TEST_F(ExtensionPrefsBlacklistedExtensions,
1268 ExtensionPrefsBlacklistedExtensions) {} 1269 ExtensionPrefsBlacklistedExtensions) {}
1269 1270
1270 } // namespace extensions 1271 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698