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

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

Issue 6677147: Handle changes in extension ID generation logic better. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "base/memory/scoped_temp_dir.h" 5 #include "base/memory/scoped_temp_dir.h"
6 #include "base/message_loop.h" 6 #include "base/message_loop.h"
7 #include "base/path_service.h" 7 #include "base/path_service.h"
8 #include "base/stl_util-inl.h" 8 #include "base/stl_util-inl.h"
9 #include "base/string_number_conversions.h" 9 #include "base/string_number_conversions.h"
10 #include "base/stringprintf.h" 10 #include "base/stringprintf.h"
(...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after
604 EXPECT_TRUE(prefs()->WasAppDraggedByUser(extension_->id())); 604 EXPECT_TRUE(prefs()->WasAppDraggedByUser(extension_->id()));
605 } 605 }
606 606
607 private: 607 private:
608 scoped_refptr<Extension> extension_; 608 scoped_refptr<Extension> extension_;
609 }; 609 };
610 TEST_F(ExtensionPrefsAppDraggedByUser, ExtensionPrefsAppDraggedByUser) {} 610 TEST_F(ExtensionPrefsAppDraggedByUser, ExtensionPrefsAppDraggedByUser) {}
611 611
612 namespace keys = extension_manifest_keys; 612 namespace keys = extension_manifest_keys;
613 613
614 // Tests that we gracefully handle changes in the ID generation function for
615 // unpacked extensions.
616 class ExtensionPrefsIdChange : public ExtensionPrefsTest {
617 public:
618 virtual void Initialize() {
619 DictionaryValue manifest;
620 manifest.SetString(keys::kVersion, "1.0.0.0");
621 manifest.SetString(keys::kName, "unused");
622
623 extension_ = prefs_.AddExtensionWithManifest(
624 manifest, Extension::LOAD);
625
626 fprintf(stderr, "generated extension id: %s\n", extension_->id().c_str());
asargent_no_longer_on_chrome 2011/04/04 23:46:15 nit: remove this debugging output, or switch to us
Mihai Parparita -not on Chrome 2011/04/05 00:22:47 Oops, removed.
627
628 DictionaryValue* extensions_dict =
629 prefs()->pref_service()->GetMutableDictionary(
630 ExtensionPrefs::kExtensionsPref);
631
632 Value* extension_prefs;
633 EXPECT_TRUE(extensions_dict->RemoveWithoutPathExpansion(
634 extension_->id(), &extension_prefs));
635 extensions_dict->SetWithoutPathExpansion(
636 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", extension_prefs);
637 }
638
639 virtual void Verify() {
640 prefs_.RecreateExtensionPrefs();
641 prefs()->SetExtensionState(extension_.get(), Extension::DISABLED);
asargent_no_longer_on_chrome 2011/04/04 23:46:15 maybe add a check here that you get back the exten
Mihai Parparita -not on Chrome 2011/04/05 00:22:47 Added a check using ExtensionPrefs::GetExtensions
642 }
643
644 private:
645 scoped_refptr<Extension> extension_;
646 };
647 TEST_F(ExtensionPrefsIdChange, IdChange) {}
648
614 class ExtensionPrefsPreferencesBase : public ExtensionPrefsTest { 649 class ExtensionPrefsPreferencesBase : public ExtensionPrefsTest {
615 public: 650 public:
616 ExtensionPrefsPreferencesBase() 651 ExtensionPrefsPreferencesBase()
617 : ExtensionPrefsTest(), 652 : ExtensionPrefsTest(),
618 ext1_(NULL), 653 ext1_(NULL),
619 ext2_(NULL), 654 ext2_(NULL),
620 ext3_(NULL), 655 ext3_(NULL),
621 installed() { 656 installed() {
622 DictionaryValue simple_dict; 657 DictionaryValue simple_dict;
623 std::string error; 658 std::string error;
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
912 testing::Mock::VerifyAndClearExpectations(v1i); 947 testing::Mock::VerifyAndClearExpectations(v1i);
913 testing::Mock::VerifyAndClearExpectations(v2); 948 testing::Mock::VerifyAndClearExpectations(v2);
914 testing::Mock::VerifyAndClearExpectations(v2i); 949 testing::Mock::VerifyAndClearExpectations(v2i);
915 } 950 }
916 951
917 virtual void Verify() { 952 virtual void Verify() {
918 } 953 }
919 }; 954 };
920 TEST_F(ExtensionPrefsSetExtensionControlledPref, 955 TEST_F(ExtensionPrefsSetExtensionControlledPref,
921 ExtensionPrefsSetExtensionControlledPref) {} 956 ExtensionPrefsSetExtensionControlledPref) {}
OLDNEW
« chrome/browser/extensions/extension_prefs.cc ('K') | « chrome/browser/extensions/extension_prefs.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698