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