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

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: Addresed comments and fixed bugs. Removed not required from_webstore arguement 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 3376 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 3394
3395 // Simple extension that should install without error. 3395 // Simple extension that should install without error.
3396 FilePath path = data_dir_.AppendASCII("good.crx"); 3396 FilePath path = data_dir_.AppendASCII("good.crx");
3397 InstallCRX(path, INSTALL_NEW); 3397 InstallCRX(path, INSTALL_NEW,
3398 Extension::FROM_BOOKMARK | Extension::FROM_WEBSTORE);
3398 const char* extension_id = good_crx; 3399 const char* extension_id = good_crx;
3399 service_->DisableExtension(extension_id, Extension::DISABLE_USER_ACTION); 3400 service_->DisableExtension(extension_id, Extension::DISABLE_USER_ACTION);
3400 3401
3401 EXPECT_EQ(0u, service_->extensions()->size()); 3402 EXPECT_EQ(0u, service_->extensions()->size());
3402 EXPECT_EQ(1u, service_->disabled_extensions()->size()); 3403 EXPECT_EQ(1u, service_->disabled_extensions()->size());
3403 3404
3404 service_->ReloadExtensions(); 3405 service_->ReloadExtensions();
3405 3406
3407 // The creation flags should not change when reloading the extension.
3408 const Extension* extension = service_->GetExtensionById(good_crx, true);
3409 EXPECT_TRUE(extension->from_bookmark());
3410 EXPECT_TRUE(extension->from_webstore());
3411 EXPECT_FALSE(extension->was_installed_by_default());
Mihai Parparita -not on Chrome 2012/10/02 17:00:54 Add a test that the was_installed_by_default flag
Gaurav 2012/10/02 23:08:57 Done.
3412
3406 // Extension counts shouldn't change. 3413 // Extension counts shouldn't change.
3407 EXPECT_EQ(0u, service_->extensions()->size()); 3414 EXPECT_EQ(0u, service_->extensions()->size());
3408 EXPECT_EQ(1u, service_->disabled_extensions()->size()); 3415 EXPECT_EQ(1u, service_->disabled_extensions()->size());
3409 3416
3410 service_->EnableExtension(extension_id); 3417 service_->EnableExtension(extension_id);
3411 3418
3412 EXPECT_EQ(1u, service_->extensions()->size()); 3419 EXPECT_EQ(1u, service_->extensions()->size());
3413 EXPECT_EQ(0u, service_->disabled_extensions()->size()); 3420 EXPECT_EQ(0u, service_->disabled_extensions()->size());
3414 3421
3415 // Need to clear |loaded_| manually before reloading as the 3422 // 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. 5542 // This should NOT trigger an alert.
5536 provider->UpdateOrAddExtension(hosted_app, "1.0.0.0", 5543 provider->UpdateOrAddExtension(hosted_app, "1.0.0.0",
5537 data_dir_.AppendASCII("hosted_app.crx")); 5544 data_dir_.AppendASCII("hosted_app.crx"));
5538 5545
5539 service_->CheckForExternalUpdates(); 5546 service_->CheckForExternalUpdates();
5540 loop_.RunAllPending(); 5547 loop_.RunAllPending();
5541 5548
5542 ASSERT_TRUE(service_->PopulateExtensionErrorUI(extension_error_ui.get())); 5549 ASSERT_TRUE(service_->PopulateExtensionErrorUI(extension_error_ui.get()));
5543 ASSERT_EQ(1u, extension_error_ui->get_external_extension_ids()->size()); 5550 ASSERT_EQ(1u, extension_error_ui->get_external_extension_ids()->size());
5544 } 5551 }
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