| 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/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 #include "chrome/test/base/testing_profile.h" | 21 #include "chrome/test/base/testing_profile.h" |
| 22 #include "content/public/browser/notification_service.h" | 22 #include "content/public/browser/notification_service.h" |
| 23 #include "content/public/test/test_utils.h" | 23 #include "content/public/test/test_utils.h" |
| 24 #include "net/test/embedded_test_server/embedded_test_server.h" | 24 #include "net/test/embedded_test_server/embedded_test_server.h" |
| 25 #include "net/test/embedded_test_server/http_request.h" | 25 #include "net/test/embedded_test_server/http_request.h" |
| 26 #include "net/test/embedded_test_server/http_response.h" | 26 #include "net/test/embedded_test_server/http_response.h" |
| 27 #include "testing/gmock/include/gmock/gmock.h" | 27 #include "testing/gmock/include/gmock/gmock.h" |
| 28 | 28 |
| 29 #if defined(OS_CHROMEOS) | 29 #if defined(OS_CHROMEOS) |
| 30 #include "chrome/browser/chromeos/customization_document.h" | 30 #include "chrome/browser/chromeos/customization_document.h" |
| 31 #include "chrome/browser/chromeos/login/fake_user_manager.h" |
| 31 #include "chromeos/system/mock_statistics_provider.h" | 32 #include "chromeos/system/mock_statistics_provider.h" |
| 32 #include "chromeos/system/statistics_provider.h" | 33 #include "chromeos/system/statistics_provider.h" |
| 33 #endif | 34 #endif |
| 34 | 35 |
| 35 using ::testing::_; | 36 using ::testing::_; |
| 36 using ::testing::NotNull; | 37 using ::testing::NotNull; |
| 37 using ::testing::Return; | 38 using ::testing::Return; |
| 38 | 39 |
| 39 namespace extensions { | 40 namespace extensions { |
| 40 | 41 |
| 41 namespace { | 42 namespace { |
| 42 | 43 |
| 43 using namespace net::test_server; | 44 using namespace net::test_server; |
| 44 | 45 |
| 45 const char kManifestPath[] = "/update_manifest"; | 46 const char kManifestPath[] = "/update_manifest"; |
| 46 const char kAppPath[] = "/app.crx"; | 47 const char kAppPath[] = "/app.crx"; |
| 47 | 48 |
| 48 class ExternalProviderImplTest : public ExtensionServiceTestBase { | 49 class ExternalProviderImplTest : public ExtensionServiceTestBase { |
| 49 public: | 50 public: |
| 50 ExternalProviderImplTest() {} | 51 ExternalProviderImplTest() {} |
| 51 virtual ~ExternalProviderImplTest() {} | 52 virtual ~ExternalProviderImplTest() {} |
| 52 | 53 |
| 53 void InitServiceWithExternalProviders() { | 54 void InitServiceWithExternalProviders() { |
| 55 #if defined(OS_CHROMEOS) |
| 56 chromeos::ScopedUserManagerEnabler scoped_user_manager( |
| 57 new chromeos::FakeUserManager); |
| 58 #endif |
| 54 InitializeExtensionServiceWithUpdater(); | 59 InitializeExtensionServiceWithUpdater(); |
| 55 | 60 |
| 56 ProviderCollection providers; | 61 ProviderCollection providers; |
| 57 extensions::ExternalProviderImpl::CreateExternalProviders( | 62 extensions::ExternalProviderImpl::CreateExternalProviders( |
| 58 service_, profile_.get(), &providers); | 63 service_, profile_.get(), &providers); |
| 59 | 64 |
| 60 for (ProviderCollection::iterator i = providers.begin(); | 65 for (ProviderCollection::iterator i = providers.begin(); |
| 61 i != providers.end(); | 66 i != providers.end(); |
| 62 ++i) { | 67 ++i) { |
| 63 service_->AddProviderForTesting(i->release()); | 68 service_->AddProviderForTesting(i->release()); |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 service_->CheckForExternalUpdates(); | 163 service_->CheckForExternalUpdates(); |
| 159 runner->Run(); | 164 runner->Run(); |
| 160 | 165 |
| 161 EXPECT_TRUE(service_->GetInstalledExtension( | 166 EXPECT_TRUE(service_->GetInstalledExtension( |
| 162 extension_misc::kInAppPaymentsSupportAppId)); | 167 extension_misc::kInAppPaymentsSupportAppId)); |
| 163 EXPECT_TRUE(service_->IsExtensionEnabled( | 168 EXPECT_TRUE(service_->IsExtensionEnabled( |
| 164 extension_misc::kInAppPaymentsSupportAppId)); | 169 extension_misc::kInAppPaymentsSupportAppId)); |
| 165 } | 170 } |
| 166 | 171 |
| 167 } // namespace extensions | 172 } // namespace extensions |
| OLD | NEW |