| 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/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/prefs/testing_pref_service.h" | 9 #include "base/prefs/testing_pref_service.h" |
| 10 #include "base/test/scoped_path_override.h" | 10 #include "base/test/scoped_path_override.h" |
| 11 #include "chrome/browser/chrome_notification_types.h" | 11 #include "chrome/browser/chrome_notification_types.h" |
| 12 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" | 12 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" |
| 13 #include "chrome/browser/chromeos/customization/customization_document.h" | 13 #include "chrome/browser/chromeos/customization/customization_document.h" |
| 14 #include "chrome/browser/chromeos/login/users/fake_user_manager.h" | |
| 15 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h" | 14 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h" |
| 16 #include "chrome/browser/extensions/extension_service.h" | 15 #include "chrome/browser/extensions/extension_service.h" |
| 17 #include "chrome/browser/extensions/extension_service_test_base.h" | 16 #include "chrome/browser/extensions/extension_service_test_base.h" |
| 18 #include "chrome/common/chrome_paths.h" | 17 #include "chrome/common/chrome_paths.h" |
| 19 #include "chrome/common/chrome_switches.h" | 18 #include "chrome/common/chrome_switches.h" |
| 20 #include "chrome/test/base/testing_browser_process.h" | 19 #include "chrome/test/base/testing_browser_process.h" |
| 21 #include "chrome/test/base/testing_profile.h" | 20 #include "chrome/test/base/testing_profile.h" |
| 22 #include "chromeos/system/fake_statistics_provider.h" | 21 #include "chromeos/system/fake_statistics_provider.h" |
| 23 #include "chromeos/system/statistics_provider.h" | 22 #include "chromeos/system/statistics_provider.h" |
| 23 #include "components/user_manager/fake_user_manager.h" |
| 24 #include "content/public/browser/notification_service.h" | 24 #include "content/public/browser/notification_service.h" |
| 25 #include "content/public/test/test_utils.h" | 25 #include "content/public/test/test_utils.h" |
| 26 | 26 |
| 27 namespace extensions { | 27 namespace extensions { |
| 28 | 28 |
| 29 namespace { | 29 namespace { |
| 30 | 30 |
| 31 const char kExternalAppId[] = "kekdneafjmhmndejhmbcadfiiofngffo"; | 31 const char kExternalAppId[] = "kekdneafjmhmndejhmbcadfiiofngffo"; |
| 32 | 32 |
| 33 class ExternalProviderImplChromeOSTest : public ExtensionServiceTestBase { | 33 class ExternalProviderImplChromeOSTest : public ExtensionServiceTestBase { |
| 34 public: | 34 public: |
| 35 ExternalProviderImplChromeOSTest() | 35 ExternalProviderImplChromeOSTest() |
| 36 : fake_user_manager_(new chromeos::FakeUserManager()), | 36 : fake_user_manager_(new user_manager::FakeUserManager()), |
| 37 scoped_user_manager_(fake_user_manager_) { | 37 scoped_user_manager_(fake_user_manager_) { |
| 38 } | 38 } |
| 39 | 39 |
| 40 ~ExternalProviderImplChromeOSTest() override {} | 40 ~ExternalProviderImplChromeOSTest() override {} |
| 41 | 41 |
| 42 void InitServiceWithExternalProviders() { | 42 void InitServiceWithExternalProviders() { |
| 43 InitializeEmptyExtensionService(); | 43 InitializeEmptyExtensionService(); |
| 44 service_->Init(); | 44 service_->Init(); |
| 45 | 45 |
| 46 ProviderCollection providers; | 46 ProviderCollection providers; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 68 | 68 |
| 69 void TearDown() override { | 69 void TearDown() override { |
| 70 chromeos::KioskAppManager::Shutdown(); | 70 chromeos::KioskAppManager::Shutdown(); |
| 71 TestingBrowserProcess::GetGlobal()->SetLocalState(NULL); | 71 TestingBrowserProcess::GetGlobal()->SetLocalState(NULL); |
| 72 } | 72 } |
| 73 | 73 |
| 74 private: | 74 private: |
| 75 TestingPrefServiceSimple local_state_; | 75 TestingPrefServiceSimple local_state_; |
| 76 scoped_ptr<base::ScopedPathOverride> external_externsions_overrides_; | 76 scoped_ptr<base::ScopedPathOverride> external_externsions_overrides_; |
| 77 chromeos::system::ScopedFakeStatisticsProvider fake_statistics_provider_; | 77 chromeos::system::ScopedFakeStatisticsProvider fake_statistics_provider_; |
| 78 chromeos::FakeUserManager* fake_user_manager_; | 78 user_manager::FakeUserManager* fake_user_manager_; |
| 79 chromeos::ScopedUserManagerEnabler scoped_user_manager_; | 79 chromeos::ScopedUserManagerEnabler scoped_user_manager_; |
| 80 | 80 |
| 81 DISALLOW_COPY_AND_ASSIGN(ExternalProviderImplChromeOSTest); | 81 DISALLOW_COPY_AND_ASSIGN(ExternalProviderImplChromeOSTest); |
| 82 }; | 82 }; |
| 83 | 83 |
| 84 } // namespace | 84 } // namespace |
| 85 | 85 |
| 86 // Normal mode, external app should be installed. | 86 // Normal mode, external app should be installed. |
| 87 TEST_F(ExternalProviderImplChromeOSTest, Normal) { | 87 TEST_F(ExternalProviderImplChromeOSTest, Normal) { |
| 88 InitServiceWithExternalProviders(); | 88 InitServiceWithExternalProviders(); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 103 | 103 |
| 104 InitServiceWithExternalProviders(); | 104 InitServiceWithExternalProviders(); |
| 105 | 105 |
| 106 service_->CheckForExternalUpdates(); | 106 service_->CheckForExternalUpdates(); |
| 107 base::RunLoop().RunUntilIdle(); | 107 base::RunLoop().RunUntilIdle(); |
| 108 | 108 |
| 109 EXPECT_FALSE(service_->GetInstalledExtension(kExternalAppId)); | 109 EXPECT_FALSE(service_->GetInstalledExtension(kExternalAppId)); |
| 110 } | 110 } |
| 111 | 111 |
| 112 } // namespace extensions | 112 } // namespace extensions |
| OLD | NEW |