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 } | |
39 | 38 |
40 ~ExternalProviderImplChromeOSTest() override {} | 39 ~ExternalProviderImplChromeOSTest() override {} |
41 | 40 |
42 void InitServiceWithExternalProviders() { | 41 void InitServiceWithExternalProviders() { |
43 InitializeEmptyExtensionService(); | 42 InitializeEmptyExtensionService(); |
44 service_->Init(); | 43 service_->Init(); |
45 | 44 |
46 ProviderCollection providers; | 45 ProviderCollection providers; |
47 extensions::ExternalProviderImpl::CreateExternalProviders( | 46 extensions::ExternalProviderImpl::CreateExternalProviders( |
48 service_, profile_.get(), &providers); | 47 service_, profile_.get(), &providers); |
(...skipping 19 matching lines...) Expand all Loading... |
68 | 67 |
69 void TearDown() override { | 68 void TearDown() override { |
70 chromeos::KioskAppManager::Shutdown(); | 69 chromeos::KioskAppManager::Shutdown(); |
71 TestingBrowserProcess::GetGlobal()->SetLocalState(NULL); | 70 TestingBrowserProcess::GetGlobal()->SetLocalState(NULL); |
72 } | 71 } |
73 | 72 |
74 private: | 73 private: |
75 TestingPrefServiceSimple local_state_; | 74 TestingPrefServiceSimple local_state_; |
76 scoped_ptr<base::ScopedPathOverride> external_externsions_overrides_; | 75 scoped_ptr<base::ScopedPathOverride> external_externsions_overrides_; |
77 chromeos::system::ScopedFakeStatisticsProvider fake_statistics_provider_; | 76 chromeos::system::ScopedFakeStatisticsProvider fake_statistics_provider_; |
78 chromeos::FakeUserManager* fake_user_manager_; | 77 user_manager::FakeUserManager* fake_user_manager_; |
79 chromeos::ScopedUserManagerEnabler scoped_user_manager_; | 78 chromeos::ScopedUserManagerEnabler scoped_user_manager_; |
80 | 79 |
81 DISALLOW_COPY_AND_ASSIGN(ExternalProviderImplChromeOSTest); | 80 DISALLOW_COPY_AND_ASSIGN(ExternalProviderImplChromeOSTest); |
82 }; | 81 }; |
83 | 82 |
84 } // namespace | 83 } // namespace |
85 | 84 |
86 // Normal mode, external app should be installed. | 85 // Normal mode, external app should be installed. |
87 TEST_F(ExternalProviderImplChromeOSTest, Normal) { | 86 TEST_F(ExternalProviderImplChromeOSTest, Normal) { |
88 InitServiceWithExternalProviders(); | 87 InitServiceWithExternalProviders(); |
(...skipping 14 matching lines...) Expand all Loading... |
103 | 102 |
104 InitServiceWithExternalProviders(); | 103 InitServiceWithExternalProviders(); |
105 | 104 |
106 service_->CheckForExternalUpdates(); | 105 service_->CheckForExternalUpdates(); |
107 base::RunLoop().RunUntilIdle(); | 106 base::RunLoop().RunUntilIdle(); |
108 | 107 |
109 EXPECT_FALSE(service_->GetInstalledExtension(kExternalAppId)); | 108 EXPECT_FALSE(service_->GetInstalledExtension(kExternalAppId)); |
110 } | 109 } |
111 | 110 |
112 } // namespace extensions | 111 } // namespace extensions |
OLD | NEW |