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

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

Issue 10977048: Fix bug in disabling sync for default apps (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Fix browser and integration tests, which got broken Created 8 years, 2 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) 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 "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 3373 matching lines...) Expand 10 before | Expand all | Expand 10 after
3384 service_->set_extensions_enabled(true); 3384 service_->set_extensions_enabled(true);
3385 service_->ReloadExtensions(); 3385 service_->ReloadExtensions();
3386 3386
3387 EXPECT_EQ(1u, service_->extensions()->size()); 3387 EXPECT_EQ(1u, service_->extensions()->size());
3388 EXPECT_EQ(0u, service_->disabled_extensions()->size()); 3388 EXPECT_EQ(0u, service_->disabled_extensions()->size());
3389 } 3389 }
3390 3390
3391 // Tests reloading extensions. 3391 // Tests reloading extensions.
3392 TEST_F(ExtensionServiceTest, ReloadExtensions) { 3392 TEST_F(ExtensionServiceTest, ReloadExtensions) {
3393 InitializeEmptyExtensionService(); 3393 InitializeEmptyExtensionService();
3394 InitializeRequestContext();
3394 3395
3395 // Simple extension that should install without error. 3396 // Simple extension that should install without error.
3396 FilePath path = data_dir_.AppendASCII("good.crx"); 3397 FilePath path = data_dir_.AppendASCII("good.crx");
3397 InstallCRX(path, INSTALL_NEW); 3398 InstallCRX(path, INSTALL_NEW,
3399 Extension::FROM_WEBSTORE | Extension::WAS_INSTALLED_BY_DEFAULT);
3398 const char* extension_id = good_crx; 3400 const char* extension_id = good_crx;
3399 service_->DisableExtension(extension_id, Extension::DISABLE_USER_ACTION); 3401 service_->DisableExtension(extension_id, Extension::DISABLE_USER_ACTION);
3400 3402
3401 EXPECT_EQ(0u, service_->extensions()->size()); 3403 EXPECT_EQ(0u, service_->extensions()->size());
3402 EXPECT_EQ(1u, service_->disabled_extensions()->size()); 3404 EXPECT_EQ(1u, service_->disabled_extensions()->size());
3403 3405
3404 service_->ReloadExtensions(); 3406 service_->ReloadExtensions();
3405 3407
3408 // The creation flags should not change when reloading the extension.
3409 const Extension* extension = service_->GetExtensionById(good_crx, true);
3410 EXPECT_TRUE(extension->from_webstore());
3411 EXPECT_TRUE(extension->was_installed_by_default());
3412 EXPECT_FALSE(extension->from_bookmark());
3413
3406 // Extension counts shouldn't change. 3414 // Extension counts shouldn't change.
3407 EXPECT_EQ(0u, service_->extensions()->size()); 3415 EXPECT_EQ(0u, service_->extensions()->size());
3408 EXPECT_EQ(1u, service_->disabled_extensions()->size()); 3416 EXPECT_EQ(1u, service_->disabled_extensions()->size());
3409 3417
3410 service_->EnableExtension(extension_id); 3418 service_->EnableExtension(extension_id);
3411 3419
3412 EXPECT_EQ(1u, service_->extensions()->size()); 3420 EXPECT_EQ(1u, service_->extensions()->size());
3413 EXPECT_EQ(0u, service_->disabled_extensions()->size()); 3421 EXPECT_EQ(0u, service_->disabled_extensions()->size());
3414 3422
3415 // Need to clear |loaded_| manually before reloading as the 3423 // Need to clear |loaded_| manually before reloading as the
(...skipping 2119 matching lines...) Expand 10 before | Expand all | Expand 10 after
5535 // This should NOT trigger an alert. 5543 // This should NOT trigger an alert.
5536 provider->UpdateOrAddExtension(hosted_app, "1.0.0.0", 5544 provider->UpdateOrAddExtension(hosted_app, "1.0.0.0",
5537 data_dir_.AppendASCII("hosted_app.crx")); 5545 data_dir_.AppendASCII("hosted_app.crx"));
5538 5546
5539 service_->CheckForExternalUpdates(); 5547 service_->CheckForExternalUpdates();
5540 loop_.RunAllPending(); 5548 loop_.RunAllPending();
5541 5549
5542 ASSERT_TRUE(service_->PopulateExtensionErrorUI(extension_error_ui.get())); 5550 ASSERT_TRUE(service_->PopulateExtensionErrorUI(extension_error_ui.get()));
5543 ASSERT_EQ(1u, extension_error_ui->get_external_extension_ids()->size()); 5551 ASSERT_EQ(1u, extension_error_ui->get_external_extension_ids()->size());
5544 } 5552 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_service.cc ('k') | chrome/browser/extensions/extension_sorting_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698