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

Side by Side Diff: chrome/browser/extensions/updater/extension_updater_unittest.cc

Issue 9977021: Add ExtensionSytem::Get(Profile*) as a wrapper around (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 | 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 <map> 5 #include <map>
6 #include <set> 6 #include <set>
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/memory/weak_ptr.h" 12 #include "base/memory/weak_ptr.h"
13 #include "base/stl_util.h" 13 #include "base/stl_util.h"
14 #include "base/string_number_conversions.h" 14 #include "base/string_number_conversions.h"
15 #include "base/string_split.h" 15 #include "base/string_split.h"
16 #include "base/string_util.h" 16 #include "base/string_util.h"
17 #include "base/stringprintf.h" 17 #include "base/stringprintf.h"
18 #include "base/threading/thread.h" 18 #include "base/threading/thread.h"
19 #include "base/version.h" 19 #include "base/version.h"
20 #include "chrome/browser/extensions/crx_installer.h" 20 #include "chrome/browser/extensions/crx_installer.h"
21 #include "chrome/browser/extensions/extension_error_reporter.h" 21 #include "chrome/browser/extensions/extension_error_reporter.h"
22 #include "chrome/browser/extensions/extension_sync_data.h" 22 #include "chrome/browser/extensions/extension_sync_data.h"
23 #include "chrome/browser/extensions/extension_system.h" 23 #include "chrome/browser/extensions/extension_system.h"
24 #include "chrome/browser/extensions/extension_system_factory.h"
25 #include "chrome/browser/extensions/test_extension_prefs.h" 24 #include "chrome/browser/extensions/test_extension_prefs.h"
26 #include "chrome/browser/extensions/test_extension_service.h" 25 #include "chrome/browser/extensions/test_extension_service.h"
27 #include "chrome/browser/extensions/test_extension_system.h" 26 #include "chrome/browser/extensions/test_extension_system.h"
28 #include "chrome/browser/extensions/updater/extension_downloader.h" 27 #include "chrome/browser/extensions/updater/extension_downloader.h"
29 #include "chrome/browser/extensions/updater/extension_downloader_delegate.h" 28 #include "chrome/browser/extensions/updater/extension_downloader_delegate.h"
30 #include "chrome/browser/extensions/updater/extension_updater.h" 29 #include "chrome/browser/extensions/updater/extension_updater.h"
31 #include "chrome/browser/extensions/updater/manifest_fetch_data.h" 30 #include "chrome/browser/extensions/updater/manifest_fetch_data.h"
32 #include "chrome/browser/google/google_util.h" 31 #include "chrome/browser/google/google_util.h"
33 #include "chrome/browser/prefs/pref_service.h" 32 #include "chrome/browser/prefs/pref_service.h"
34 #include "chrome/common/chrome_notification_types.h" 33 #include "chrome/common/chrome_notification_types.h"
(...skipping 945 matching lines...) Expand 10 before | Expand all | Expand 10 after
980 EXPECT_TRUE(fetcher != NULL && fetcher->delegate() != NULL); 979 EXPECT_TRUE(fetcher != NULL && fetcher->delegate() != NULL);
981 EXPECT_TRUE(fetcher->GetLoadFlags() == kExpectedLoadFlags); 980 EXPECT_TRUE(fetcher->GetLoadFlags() == kExpectedLoadFlags);
982 981
983 // We need some CrxInstallers, and CrxInstallers require a real 982 // We need some CrxInstallers, and CrxInstallers require a real
984 // ExtensionService. Create one on the testing profile. Any action 983 // ExtensionService. Create one on the testing profile. Any action
985 // the CrxInstallers take is on the testing profile's extension 984 // the CrxInstallers take is on the testing profile's extension
986 // service, not on our mock |service|. This allows us to fake 985 // service, not on our mock |service|. This allows us to fake
987 // the CrxInstaller actions we want. 986 // the CrxInstaller actions we want.
988 TestingProfile profile; 987 TestingProfile profile;
989 static_cast<TestExtensionSystem*>( 988 static_cast<TestExtensionSystem*>(
990 ExtensionSystemFactory::GetForProfile(&profile))-> 989 ExtensionSystem::Get(&profile))->
991 CreateExtensionService( 990 CreateExtensionService(
992 CommandLine::ForCurrentProcess(), 991 CommandLine::ForCurrentProcess(),
993 FilePath(), 992 FilePath(),
994 false); 993 false);
995 ExtensionService* extension_service = 994 ExtensionService* extension_service =
996 ExtensionSystemFactory::GetForProfile(&profile)->extension_service(); 995 ExtensionSystem::Get(&profile)->extension_service();
997 extension_service->set_extensions_enabled(true); 996 extension_service->set_extensions_enabled(true);
998 extension_service->set_show_extensions_prompts(false); 997 extension_service->set_show_extensions_prompts(false);
999 998
1000 scoped_refptr<CrxInstaller> fake_crx1( 999 scoped_refptr<CrxInstaller> fake_crx1(
1001 CrxInstaller::Create(extension_service, NULL)); 1000 CrxInstaller::Create(extension_service, NULL));
1002 scoped_refptr<CrxInstaller> fake_crx2( 1001 scoped_refptr<CrxInstaller> fake_crx2(
1003 CrxInstaller::Create(extension_service, NULL)); 1002 CrxInstaller::Create(extension_service, NULL));
1004 1003
1005 if (updates_start_running) { 1004 if (updates_start_running) {
1006 // Add fake CrxInstaller to be returned by service.UpdateExtension(). 1005 // Add fake CrxInstaller to be returned by service.UpdateExtension().
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after
1506 // -prodversionmin (shouldn't update if browser version too old) 1505 // -prodversionmin (shouldn't update if browser version too old)
1507 // -manifests & updates arriving out of order / interleaved 1506 // -manifests & updates arriving out of order / interleaved
1508 // -malformed update url (empty, file://, has query, has a # fragment, etc.) 1507 // -malformed update url (empty, file://, has query, has a # fragment, etc.)
1509 // -An extension gets uninstalled while updates are in progress (so it doesn't 1508 // -An extension gets uninstalled while updates are in progress (so it doesn't
1510 // "come back from the dead") 1509 // "come back from the dead")
1511 // -An extension gets manually updated to v3 while we're downloading v2 (ie 1510 // -An extension gets manually updated to v3 while we're downloading v2 (ie
1512 // you don't get downgraded accidentally) 1511 // you don't get downgraded accidentally)
1513 // -An update manifest mentions multiple updates 1512 // -An update manifest mentions multiple updates
1514 1513
1515 } // namespace extensions 1514 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698