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/chromeos/app_mode/kiosk_app_update_service.h" | 5 #include "chrome/browser/chromeos/app_mode/kiosk_app_update_service.h" |
6 | 6 |
| 7 #include <memory> |
7 #include <string> | 8 #include <string> |
8 | 9 |
9 #include "base/bind.h" | 10 #include "base/bind.h" |
10 #include "base/callback.h" | 11 #include "base/callback.h" |
11 #include "base/command_line.h" | 12 #include "base/command_line.h" |
12 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
13 #include "base/files/file_path.h" | 14 #include "base/files/file_path.h" |
14 #include "base/files/file_util.h" | 15 #include "base/files/file_util.h" |
15 #include "base/files/scoped_temp_dir.h" | 16 #include "base/files/scoped_temp_dir.h" |
16 #include "base/location.h" | 17 #include "base/location.h" |
17 #include "base/macros.h" | 18 #include "base/macros.h" |
18 #include "base/memory/ref_counted.h" | 19 #include "base/memory/ref_counted.h" |
19 #include "base/memory/scoped_ptr.h" | |
20 #include "base/run_loop.h" | 20 #include "base/run_loop.h" |
21 #include "base/single_thread_task_runner.h" | 21 #include "base/single_thread_task_runner.h" |
22 #include "base/strings/string_number_conversions.h" | 22 #include "base/strings/string_number_conversions.h" |
23 #include "base/test/scoped_path_override.h" | 23 #include "base/test/scoped_path_override.h" |
24 #include "base/thread_task_runner_handle.h" | 24 #include "base/thread_task_runner_handle.h" |
25 #include "base/threading/sequenced_worker_pool.h" | 25 #include "base/threading/sequenced_worker_pool.h" |
26 #include "base/time/time.h" | 26 #include "base/time/time.h" |
27 #include "chrome/browser/apps/app_browsertest_util.h" | 27 #include "chrome/browser/apps/app_browsertest_util.h" |
28 #include "chrome/browser/browser_process.h" | 28 #include "chrome/browser/browser_process.h" |
29 #include "chrome/browser/browser_process_platform_part.h" | 29 #include "chrome/browser/browser_process_platform_part.h" |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 | 144 |
145 void RequestPeriodicReboot() { | 145 void RequestPeriodicReboot() { |
146 run_loop_.reset(new base::RunLoop); | 146 run_loop_.reset(new base::RunLoop); |
147 g_browser_process->local_state()->SetInteger( | 147 g_browser_process->local_state()->SetInteger( |
148 prefs::kUptimeLimit, base::TimeDelta::FromHours(2).InSeconds()); | 148 prefs::kUptimeLimit, base::TimeDelta::FromHours(2).InSeconds()); |
149 run_loop_->Run(); | 149 run_loop_->Run(); |
150 } | 150 } |
151 | 151 |
152 private: | 152 private: |
153 base::ScopedTempDir temp_dir_; | 153 base::ScopedTempDir temp_dir_; |
154 scoped_ptr<base::ScopedPathOverride> uptime_file_override_; | 154 std::unique_ptr<base::ScopedPathOverride> uptime_file_override_; |
155 const extensions::Extension* app_; // Not owned. | 155 const extensions::Extension* app_; // Not owned. |
156 KioskAppUpdateService* update_service_; // Not owned. | 156 KioskAppUpdateService* update_service_; // Not owned. |
157 system::AutomaticRebootManager* automatic_reboot_manager_; // Not owned. | 157 system::AutomaticRebootManager* automatic_reboot_manager_; // Not owned. |
158 scoped_ptr<base::RunLoop> run_loop_; | 158 std::unique_ptr<base::RunLoop> run_loop_; |
159 | 159 |
160 DISALLOW_COPY_AND_ASSIGN(KioskAppUpdateServiceTest); | 160 DISALLOW_COPY_AND_ASSIGN(KioskAppUpdateServiceTest); |
161 }; | 161 }; |
162 | 162 |
163 // Verifies that the app is notified a reboot is required when an app update | 163 // Verifies that the app is notified a reboot is required when an app update |
164 // becomes available. | 164 // becomes available. |
165 IN_PROC_BROWSER_TEST_F(KioskAppUpdateServiceTest, AppUpdate) { | 165 IN_PROC_BROWSER_TEST_F(KioskAppUpdateServiceTest, AppUpdate) { |
166 CreateKioskAppUpdateService(); | 166 CreateKioskAppUpdateService(); |
167 | 167 |
168 ExtensionTestMessageListener listener("app_update", false); | 168 ExtensionTestMessageListener listener("app_update", false); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 // was requested before Chrome was started. | 208 // was requested before Chrome was started. |
209 IN_PROC_BROWSER_TEST_F(KioskAppUpdateServiceTest, StartAfterPeriodic) { | 209 IN_PROC_BROWSER_TEST_F(KioskAppUpdateServiceTest, StartAfterPeriodic) { |
210 RequestPeriodicReboot(); | 210 RequestPeriodicReboot(); |
211 | 211 |
212 ExtensionTestMessageListener listener("periodic", false); | 212 ExtensionTestMessageListener listener("periodic", false); |
213 CreateKioskAppUpdateService(); | 213 CreateKioskAppUpdateService(); |
214 listener.WaitUntilSatisfied(); | 214 listener.WaitUntilSatisfied(); |
215 } | 215 } |
216 | 216 |
217 } // namespace chromeos | 217 } // namespace chromeos |
OLD | NEW |