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

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

Issue 6903127: [Sync] Add support for enabling/disabling an extension before it's installed (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix typo Created 9 years, 7 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 3611 matching lines...) Expand 10 before | Expand all | Expand 10 after
3622 3622
3623 EXPECT_FALSE(service_->pending_extension_manager()->IsIdPending(good_crx)); 3623 EXPECT_FALSE(service_->pending_extension_manager()->IsIdPending(good_crx));
3624 } 3624 }
3625 3625
3626 TEST_F(ExtensionServiceTest, ProcessSyncDataNotInstalled) { 3626 TEST_F(ExtensionServiceTest, ProcessSyncDataNotInstalled) {
3627 InitializeExtensionServiceWithUpdater(); 3627 InitializeExtensionServiceWithUpdater();
3628 3628
3629 ExtensionSyncData extension_sync_data; 3629 ExtensionSyncData extension_sync_data;
3630 extension_sync_data.id = good_crx; 3630 extension_sync_data.id = good_crx;
3631 extension_sync_data.update_url = GURL("http://www.google.com"); 3631 extension_sync_data.update_url = GURL("http://www.google.com");
3632 extension_sync_data.enabled = true; 3632 extension_sync_data.enabled = false;
3633 extension_sync_data.incognito_enabled = true; 3633 extension_sync_data.incognito_enabled = true;
3634 { 3634 {
3635 scoped_ptr<Version> version(Version::GetVersionFromString("1.2.3.4")); 3635 scoped_ptr<Version> version(Version::GetVersionFromString("1.2.3.4"));
3636 extension_sync_data.version = *version; 3636 extension_sync_data.version = *version;
3637 } 3637 }
3638 3638
3639 EXPECT_TRUE(service_->IsExtensionEnabled(good_crx));
3639 EXPECT_FALSE(service_->IsIncognitoEnabled(good_crx)); 3640 EXPECT_FALSE(service_->IsIncognitoEnabled(good_crx));
3640 service_->ProcessSyncData(extension_sync_data, &AllExtensions); 3641 service_->ProcessSyncData(extension_sync_data, &AllExtensions);
3641 EXPECT_TRUE(service_->updater()->WillCheckSoon()); 3642 EXPECT_TRUE(service_->updater()->WillCheckSoon());
3643 EXPECT_FALSE(service_->IsExtensionEnabled(good_crx));
3642 EXPECT_TRUE(service_->IsIncognitoEnabled(good_crx)); 3644 EXPECT_TRUE(service_->IsIncognitoEnabled(good_crx));
3643 3645
3644 PendingExtensionInfo info; 3646 PendingExtensionInfo info;
3645 EXPECT_TRUE( 3647 EXPECT_TRUE(
3646 service_->pending_extension_manager()->GetById(good_crx, &info)); 3648 service_->pending_extension_manager()->GetById(good_crx, &info));
3647 EXPECT_EQ(extension_sync_data.update_url, info.update_url()); 3649 EXPECT_EQ(extension_sync_data.update_url, info.update_url());
3648 EXPECT_TRUE(info.is_from_sync()); 3650 EXPECT_TRUE(info.is_from_sync());
3649 EXPECT_TRUE(info.install_silently()); 3651 EXPECT_TRUE(info.install_silently());
3650 EXPECT_EQ(extension_sync_data.enabled, info.enable_on_install()); 3652 EXPECT_EQ(extension_sync_data.enabled, info.enable_on_install());
3651 EXPECT_EQ(Extension::INTERNAL, info.install_source()); 3653 EXPECT_EQ(Extension::INTERNAL, info.install_source());
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
3797 ASSERT_FALSE(AddPendingSyncInstall()); 3799 ASSERT_FALSE(AddPendingSyncInstall());
3798 3800
3799 // Wait for the external source to install. 3801 // Wait for the external source to install.
3800 WaitForCrxInstall(crx_path_, true); 3802 WaitForCrxInstall(crx_path_, true);
3801 ASSERT_TRUE(IsCrxInstalled()); 3803 ASSERT_TRUE(IsCrxInstalled());
3802 3804
3803 // Now that the extension is installed, sync request should fail 3805 // Now that the extension is installed, sync request should fail
3804 // because the extension is already installed. 3806 // because the extension is already installed.
3805 ASSERT_FALSE(AddPendingSyncInstall()); 3807 ASSERT_FALSE(AddPendingSyncInstall());
3806 } 3808 }
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