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