OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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/external_provider_impl.h" | 5 #include "chrome/browser/extensions/external_provider_impl.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "base/path_service.h" | 11 #include "base/path_service.h" |
12 #include "base/prefs/testing_pref_service.h" | 12 #include "base/prefs/testing_pref_service.h" |
13 #include "base/strings/stringprintf.h" | 13 #include "base/strings/stringprintf.h" |
14 #include "base/test/scoped_path_override.h" | 14 #include "base/test/scoped_path_override.h" |
15 #include "chrome/browser/chrome_notification_types.h" | 15 #include "chrome/browser/chrome_notification_types.h" |
16 #include "chrome/browser/extensions/extension_service.h" | 16 #include "chrome/browser/extensions/extension_service.h" |
17 #include "chrome/browser/extensions/extension_service_test_base.h" | 17 #include "chrome/browser/extensions/extension_service_test_base.h" |
18 #include "chrome/browser/extensions/updater/extension_cache_fake.h" | 18 #include "chrome/browser/extensions/updater/extension_cache_fake.h" |
| 19 #include "chrome/browser/extensions/updater/extension_updater.h" |
19 #include "chrome/common/chrome_paths.h" | 20 #include "chrome/common/chrome_paths.h" |
20 #include "chrome/common/chrome_switches.h" | 21 #include "chrome/common/chrome_switches.h" |
21 #include "chrome/common/extensions/extension_constants.h" | 22 #include "chrome/common/extensions/extension_constants.h" |
22 #include "chrome/common/pref_names.h" | 23 #include "chrome/common/pref_names.h" |
23 #include "chrome/test/base/testing_browser_process.h" | 24 #include "chrome/test/base/testing_browser_process.h" |
24 #include "chrome/test/base/testing_profile.h" | 25 #include "chrome/test/base/testing_profile.h" |
25 #include "content/public/browser/notification_service.h" | 26 #include "content/public/browser/notification_service.h" |
26 #include "content/public/test/test_utils.h" | 27 #include "content/public/test/test_utils.h" |
27 #include "net/test/embedded_test_server/embedded_test_server.h" | 28 #include "net/test/embedded_test_server/embedded_test_server.h" |
28 #include "net/test/embedded_test_server/http_request.h" | 29 #include "net/test/embedded_test_server/http_request.h" |
(...skipping 26 matching lines...) Expand all Loading... |
55 ExternalProviderImplTest() {} | 56 ExternalProviderImplTest() {} |
56 virtual ~ExternalProviderImplTest() {} | 57 virtual ~ExternalProviderImplTest() {} |
57 | 58 |
58 void InitServiceWithExternalProviders() { | 59 void InitServiceWithExternalProviders() { |
59 #if defined(OS_CHROMEOS) | 60 #if defined(OS_CHROMEOS) |
60 chromeos::ScopedUserManagerEnabler scoped_user_manager( | 61 chromeos::ScopedUserManagerEnabler scoped_user_manager( |
61 new chromeos::FakeUserManager); | 62 new chromeos::FakeUserManager); |
62 #endif | 63 #endif |
63 InitializeExtensionServiceWithUpdater(); | 64 InitializeExtensionServiceWithUpdater(); |
64 | 65 |
| 66 service()->updater()->SetExtensionCacheForTesting( |
| 67 test_extension_cache_.get()); |
| 68 |
65 // Don't install default apps. Some of the default apps are downloaded from | 69 // Don't install default apps. Some of the default apps are downloaded from |
66 // the webstore, ignoring the url we pass to kAppsGalleryUpdateURL, which | 70 // the webstore, ignoring the url we pass to kAppsGalleryUpdateURL, which |
67 // would cause the external updates to never finish install. | 71 // would cause the external updates to never finish install. |
68 profile_->GetPrefs()->SetString(prefs::kDefaultApps, ""); | 72 profile_->GetPrefs()->SetString(prefs::kDefaultApps, ""); |
69 | 73 |
70 ProviderCollection providers; | 74 ProviderCollection providers; |
71 extensions::ExternalProviderImpl::CreateExternalProviders( | 75 extensions::ExternalProviderImpl::CreateExternalProviders( |
72 service_, profile_.get(), &providers); | 76 service_, profile_.get(), &providers); |
73 | 77 |
74 for (ProviderCollection::iterator i = providers.begin(); | 78 for (ProviderCollection::iterator i = providers.begin(); |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 service_->CheckForExternalUpdates(); | 176 service_->CheckForExternalUpdates(); |
173 runner->Run(); | 177 runner->Run(); |
174 | 178 |
175 EXPECT_TRUE(service_->GetInstalledExtension( | 179 EXPECT_TRUE(service_->GetInstalledExtension( |
176 extension_misc::kInAppPaymentsSupportAppId)); | 180 extension_misc::kInAppPaymentsSupportAppId)); |
177 EXPECT_TRUE(service_->IsExtensionEnabled( | 181 EXPECT_TRUE(service_->IsExtensionEnabled( |
178 extension_misc::kInAppPaymentsSupportAppId)); | 182 extension_misc::kInAppPaymentsSupportAppId)); |
179 } | 183 } |
180 | 184 |
181 } // namespace extensions | 185 } // namespace extensions |
OLD | NEW |