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

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

Issue 7795011: Fixing crash on sync when app becomes extension or vice versa. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 4 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
« no previous file with comments | « chrome/browser/extensions/extension_service.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/extension_service_unittest.cc
diff --git a/chrome/browser/extensions/extension_service_unittest.cc b/chrome/browser/extensions/extension_service_unittest.cc
index 23ae3105739217336717d1032e232d2c66e5cb80..a374f1aba2c245b2595b4a327d71896224a3486d 100644
--- a/chrome/browser/extensions/extension_service_unittest.cc
+++ b/chrome/browser/extensions/extension_service_unittest.cc
@@ -40,6 +40,7 @@
#include "chrome/browser/prefs/browser_prefs.h"
#include "chrome/browser/prefs/pref_service_mock_builder.h"
#include "chrome/browser/prefs/scoped_user_pref_update.h"
+#include "chrome/browser/sync/protocol/app_specifics.pb.h"
#include "chrome/browser/sync/protocol/extension_specifics.pb.h"
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/chrome_paths.h"
@@ -3612,6 +3613,48 @@ TEST_F(ExtensionServiceTest, ProcessSyncDataUninstall) {
EXPECT_FALSE(service_->GetExtensionById(good_crx, true));
}
+TEST_F(ExtensionServiceTest, ProcessSyncDataWrongType) {
+ InitializeEmptyExtensionService();
+
+ // Install the extension.
+ FilePath extension_path = data_dir_.AppendASCII("good.crx");
+ InstallCrx(extension_path, true);
+ EXPECT_TRUE(service_->GetExtensionById(good_crx, true));
+
+ sync_pb::EntitySpecifics specifics;
+ sync_pb::AppSpecifics* app_specifics =
+ specifics.MutableExtension(sync_pb::app);
+ sync_pb::ExtensionSpecifics* extension_specifics =
+ app_specifics->mutable_extension();
+ extension_specifics->set_id(good_crx);
+ extension_specifics->set_version(
+ service_->GetInstalledExtension(good_crx)->version()->GetString());
+
+ {
+ extension_specifics->set_enabled(true);
+ SyncData sync_data = SyncData::CreateLocalData(good_crx, "Name", specifics);
+ SyncChange sync_change(SyncChange::ACTION_DELETE, sync_data);
+ SyncChangeList list(1);
+ list[0] = sync_change;
+
+ // Should do nothing
+ service_->ProcessSyncChanges(FROM_HERE, list);
+ EXPECT_TRUE(service_->GetExtensionById(good_crx, true));
+ }
+
+ {
+ extension_specifics->set_enabled(false);
+ SyncData sync_data = SyncData::CreateLocalData(good_crx, "Name", specifics);
+ SyncChange sync_change(SyncChange::ACTION_UPDATE, sync_data);
+ SyncChangeList list(1);
+ list[0] = sync_change;
+
+ // Should again do nothing.
+ service_->ProcessSyncChanges(FROM_HERE, list);
+ EXPECT_TRUE(service_->GetExtensionById(good_crx, false));
+ }
+}
+
TEST_F(ExtensionServiceTest, ProcessSyncDataSettings) {
InitializeEmptyExtensionService();
TestSyncProcessorStub processor;
« no previous file with comments | « chrome/browser/extensions/extension_service.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698