| 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" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 #include "chrome/test/base/testing_profile.h" | 26 #include "chrome/test/base/testing_profile.h" |
| 27 #include "content/public/browser/notification_service.h" | 27 #include "content/public/browser/notification_service.h" |
| 28 #include "content/public/test/test_utils.h" | 28 #include "content/public/test/test_utils.h" |
| 29 #include "net/test/embedded_test_server/embedded_test_server.h" | 29 #include "net/test/embedded_test_server/embedded_test_server.h" |
| 30 #include "net/test/embedded_test_server/http_request.h" | 30 #include "net/test/embedded_test_server/http_request.h" |
| 31 #include "net/test/embedded_test_server/http_response.h" | 31 #include "net/test/embedded_test_server/http_response.h" |
| 32 #include "testing/gmock/include/gmock/gmock.h" | 32 #include "testing/gmock/include/gmock/gmock.h" |
| 33 | 33 |
| 34 #if defined(OS_CHROMEOS) | 34 #if defined(OS_CHROMEOS) |
| 35 #include "chrome/browser/chromeos/customization/customization_document.h" | 35 #include "chrome/browser/chromeos/customization/customization_document.h" |
| 36 #include "chrome/browser/chromeos/login/users/fake_user_manager.h" | |
| 37 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h" | 36 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h" |
| 38 #include "chromeos/system/fake_statistics_provider.h" | 37 #include "chromeos/system/fake_statistics_provider.h" |
| 39 #include "chromeos/system/statistics_provider.h" | 38 #include "chromeos/system/statistics_provider.h" |
| 39 #include "components/user_manager/fake_user_manager.h" |
| 40 #endif | 40 #endif |
| 41 | 41 |
| 42 using ::testing::NotNull; | 42 using ::testing::NotNull; |
| 43 using ::testing::Return; | 43 using ::testing::Return; |
| 44 using ::testing::_; | 44 using ::testing::_; |
| 45 | 45 |
| 46 namespace extensions { | 46 namespace extensions { |
| 47 | 47 |
| 48 namespace { | 48 namespace { |
| 49 | 49 |
| 50 using namespace net::test_server; | 50 using namespace net::test_server; |
| 51 | 51 |
| 52 const char kManifestPath[] = "/update_manifest"; | 52 const char kManifestPath[] = "/update_manifest"; |
| 53 const char kAppPath[] = "/app.crx"; | 53 const char kAppPath[] = "/app.crx"; |
| 54 | 54 |
| 55 class ExternalProviderImplTest : public ExtensionServiceTestBase { | 55 class ExternalProviderImplTest : public ExtensionServiceTestBase { |
| 56 public: | 56 public: |
| 57 ExternalProviderImplTest() {} | 57 ExternalProviderImplTest() {} |
| 58 ~ExternalProviderImplTest() override {} | 58 ~ExternalProviderImplTest() override {} |
| 59 | 59 |
| 60 void InitServiceWithExternalProviders() { | 60 void InitServiceWithExternalProviders() { |
| 61 #if defined(OS_CHROMEOS) | 61 #if defined(OS_CHROMEOS) |
| 62 chromeos::ScopedUserManagerEnabler scoped_user_manager( | 62 chromeos::ScopedUserManagerEnabler scoped_user_manager( |
| 63 new chromeos::FakeUserManager); | 63 new user_manager::FakeUserManager); |
| 64 #endif | 64 #endif |
| 65 InitializeExtensionServiceWithUpdaterAndPrefs(); | 65 InitializeExtensionServiceWithUpdaterAndPrefs(); |
| 66 | 66 |
| 67 service()->updater()->SetExtensionCacheForTesting( | 67 service()->updater()->SetExtensionCacheForTesting( |
| 68 test_extension_cache_.get()); | 68 test_extension_cache_.get()); |
| 69 | 69 |
| 70 // Don't install default apps. Some of the default apps are downloaded from | 70 // Don't install default apps. Some of the default apps are downloaded from |
| 71 // the webstore, ignoring the url we pass to kAppsGalleryUpdateURL, which | 71 // the webstore, ignoring the url we pass to kAppsGalleryUpdateURL, which |
| 72 // would cause the external updates to never finish install. | 72 // would cause the external updates to never finish install. |
| 73 profile_->GetPrefs()->SetString(prefs::kDefaultApps, ""); | 73 profile_->GetPrefs()->SetString(prefs::kDefaultApps, ""); |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 service_->CheckForExternalUpdates(); | 182 service_->CheckForExternalUpdates(); |
| 183 runner->Run(); | 183 runner->Run(); |
| 184 | 184 |
| 185 EXPECT_TRUE(service_->GetInstalledExtension( | 185 EXPECT_TRUE(service_->GetInstalledExtension( |
| 186 extension_misc::kInAppPaymentsSupportAppId)); | 186 extension_misc::kInAppPaymentsSupportAppId)); |
| 187 EXPECT_TRUE(service_->IsExtensionEnabled( | 187 EXPECT_TRUE(service_->IsExtensionEnabled( |
| 188 extension_misc::kInAppPaymentsSupportAppId)); | 188 extension_misc::kInAppPaymentsSupportAppId)); |
| 189 } | 189 } |
| 190 | 190 |
| 191 } // namespace extensions | 191 } // namespace extensions |
| OLD | NEW |