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

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

Issue 7744057: Do not attempt to apply app sync updates to extensions with matching ID, or vice versa. (Closed) Base URL: svn://svn.chromium.org/chrome/branches/835/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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/extensions/extension_service.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "chrome/browser/extensions/extension_service_unittest.h" 5 #include "chrome/browser/extensions/extension_service_unittest.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 3522 matching lines...) Expand 10 before | Expand all | Expand 10 after
3533 EXPECT_TRUE(service_->GetExtensionById(good_crx, true)); 3533 EXPECT_TRUE(service_->GetExtensionById(good_crx, true));
3534 3534
3535 // Should uninstall the extension. 3535 // Should uninstall the extension.
3536 service_->ProcessSyncData(extension_sync_data, &AllExtensions); 3536 service_->ProcessSyncData(extension_sync_data, &AllExtensions);
3537 EXPECT_FALSE(service_->GetExtensionById(good_crx, true)); 3537 EXPECT_FALSE(service_->GetExtensionById(good_crx, true));
3538 3538
3539 // Should again do nothing. 3539 // Should again do nothing.
3540 service_->ProcessSyncData(extension_sync_data, &AllExtensions); 3540 service_->ProcessSyncData(extension_sync_data, &AllExtensions);
3541 } 3541 }
3542 3542
3543 TEST_F(ExtensionServiceTest, ProcessSyncDataWrongType) {
3544 InitializeEmptyExtensionService();
3545
3546 ExtensionSyncData extension_sync_data;
3547 extension_sync_data.id = good_crx;
3548 extension_sync_data.uninstalled = true;
3549
3550 // Install the extension.
3551 FilePath extension_path = data_dir_.AppendASCII("good.crx");
3552 InstallCrx(extension_path, true);
3553 EXPECT_TRUE(service_->GetExtensionById(good_crx, true));
3554
3555 // Should do nothing
3556 service_->ProcessSyncData(extension_sync_data, &ThemesOnly);
3557 EXPECT_TRUE(service_->GetExtensionById(good_crx, true));
3558
3559 extension_sync_data.uninstalled = false;
3560 extension_sync_data.enabled = false;
3561
3562 // Should again do nothing.
3563 service_->ProcessSyncData(extension_sync_data, &ThemesOnly);
3564 EXPECT_TRUE(service_->GetExtensionById(good_crx, false));
3565 }
3543 3566
3544 TEST_F(ExtensionServiceTest, ProcessSyncDataSettings) { 3567 TEST_F(ExtensionServiceTest, ProcessSyncDataSettings) {
3545 InitializeEmptyExtensionService(); 3568 InitializeEmptyExtensionService();
3546 3569
3547 InstallCrx(data_dir_.AppendASCII("good.crx"), true); 3570 InstallCrx(data_dir_.AppendASCII("good.crx"), true);
3548 EXPECT_TRUE(service_->IsExtensionEnabled(good_crx)); 3571 EXPECT_TRUE(service_->IsExtensionEnabled(good_crx));
3549 EXPECT_FALSE(service_->IsIncognitoEnabled(good_crx)); 3572 EXPECT_FALSE(service_->IsIncognitoEnabled(good_crx));
3550 3573
3551 ExtensionSyncData extension_sync_data; 3574 ExtensionSyncData extension_sync_data;
3552 extension_sync_data.id = good_crx; 3575 extension_sync_data.id = good_crx;
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
3805 ASSERT_FALSE(AddPendingSyncInstall()); 3828 ASSERT_FALSE(AddPendingSyncInstall());
3806 3829
3807 // Wait for the external source to install. 3830 // Wait for the external source to install.
3808 WaitForCrxInstall(crx_path_, true); 3831 WaitForCrxInstall(crx_path_, true);
3809 ASSERT_TRUE(IsCrxInstalled()); 3832 ASSERT_TRUE(IsCrxInstalled());
3810 3833
3811 // Now that the extension is installed, sync request should fail 3834 // Now that the extension is installed, sync request should fail
3812 // because the extension is already installed. 3835 // because the extension is already installed.
3813 ASSERT_FALSE(AddPendingSyncInstall()); 3836 ASSERT_FALSE(AddPendingSyncInstall());
3814 } 3837 }
OLDNEW
« 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