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

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

Issue 226023003: Create CrxInstaller directly in WebstoreInstaller (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Android compilation fix (again). Created 6 years, 8 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
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 963 matching lines...) Expand 10 before | Expand all | Expand 10 after
974 int previous_enabled_extension_count = 974 int previous_enabled_extension_count =
975 registry_->enabled_extensions().size(); 975 registry_->enabled_extensions().size();
976 int previous_installed_extension_count = 976 int previous_installed_extension_count =
977 previous_enabled_extension_count + 977 previous_enabled_extension_count +
978 registry_->disabled_extensions().size(); 978 registry_->disabled_extensions().size();
979 979
980 extensions::CrxInstaller* installer = NULL; 980 extensions::CrxInstaller* installer = NULL;
981 content::WindowedNotificationObserver observer( 981 content::WindowedNotificationObserver observer(
982 chrome::NOTIFICATION_CRX_INSTALLER_DONE, 982 chrome::NOTIFICATION_CRX_INSTALLER_DONE,
983 base::Bind(&IsCrxInstallerDone, &installer)); 983 base::Bind(&IsCrxInstallerDone, &installer));
984 service_->UpdateExtension(id, path, true, GURL(), &installer); 984 service_->UpdateExtension(id, path, true, &installer);
985 985
986 if (installer) 986 if (installer)
987 observer.Wait(); 987 observer.Wait();
988 else 988 else
989 base::RunLoop().RunUntilIdle(); 989 base::RunLoop().RunUntilIdle();
990 990
991 std::vector<base::string16> errors = GetErrors(); 991 std::vector<base::string16> errors = GetErrors();
992 int error_count = errors.size(); 992 int error_count = errors.size();
993 int enabled_extension_count = registry_->enabled_extensions().size(); 993 int enabled_extension_count = registry_->enabled_extensions().size();
994 int installed_extension_count = 994 int installed_extension_count =
(...skipping 1787 matching lines...) Expand 10 before | Expand all | Expand 10 after
2782 // Install an extension. 2782 // Install an extension.
2783 base::FilePath path = data_dir_.AppendASCII("good.crx"); 2783 base::FilePath path = data_dir_.AppendASCII("good.crx");
2784 const Extension* good = InstallCRX(path, INSTALL_NEW); 2784 const Extension* good = InstallCRX(path, INSTALL_NEW);
2785 ASSERT_EQ(good_crx, good->id()); 2785 ASSERT_EQ(good_crx, good->id());
2786 2786
2787 // Simulate shutdown. 2787 // Simulate shutdown.
2788 service_->set_browser_terminating_for_test(true); 2788 service_->set_browser_terminating_for_test(true);
2789 2789
2790 // Update should fail and extension should not be updated. 2790 // Update should fail and extension should not be updated.
2791 path = data_dir_.AppendASCII("good2.crx"); 2791 path = data_dir_.AppendASCII("good2.crx");
2792 bool updated = service_->UpdateExtension(good_crx, path, true, GURL(), NULL); 2792 bool updated = service_->UpdateExtension(good_crx, path, true, NULL);
2793 ASSERT_FALSE(updated); 2793 ASSERT_FALSE(updated);
2794 ASSERT_EQ("1.0.0.0", 2794 ASSERT_EQ("1.0.0.0",
2795 service_->GetExtensionById(good_crx, false)-> 2795 service_->GetExtensionById(good_crx, false)->
2796 version()->GetString()); 2796 version()->GetString());
2797 } 2797 }
2798 2798
2799 // Test updating a not-already-installed extension - this should fail 2799 // Test updating a not-already-installed extension - this should fail
2800 TEST_F(ExtensionServiceTest, UpdateNotInstalledExtension) { 2800 TEST_F(ExtensionServiceTest, UpdateNotInstalledExtension) {
2801 InitializeEmptyExtensionService(); 2801 InitializeEmptyExtensionService();
2802 2802
(...skipping 4107 matching lines...) Expand 10 before | Expand all | Expand 10 after
6910 // ReconcileKnownDisabled(). 6910 // ReconcileKnownDisabled().
6911 service_->EnableExtension(good2); 6911 service_->EnableExtension(good2);
6912 service_->ReconcileKnownDisabled(); 6912 service_->ReconcileKnownDisabled();
6913 expected_extensions.insert(good2); 6913 expected_extensions.insert(good2);
6914 expected_disabled_extensions.erase(good2); 6914 expected_disabled_extensions.erase(good2);
6915 6915
6916 EXPECT_EQ(expected_extensions, registry_->enabled_extensions().GetIDs()); 6916 EXPECT_EQ(expected_extensions, registry_->enabled_extensions().GetIDs());
6917 EXPECT_EQ(expected_disabled_extensions, 6917 EXPECT_EQ(expected_disabled_extensions,
6918 registry_->disabled_extensions().GetIDs()); 6918 registry_->disabled_extensions().GetIDs());
6919 } 6919 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_service.cc ('k') | chrome/browser/extensions/test_extension_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698