| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 <memory> | 5 #include <memory> |
| 6 #include <vector> | 6 #include <vector> |
| 7 | 7 |
| 8 #include "ash/desktop_background/desktop_background_controller.h" | |
| 9 #include "ash/desktop_background/desktop_background_controller_observer.h" | |
| 10 #include "ash/shell.h" | 8 #include "ash/shell.h" |
| 9 #include "ash/wallpaper/wallpaper_controller.h" |
| 10 #include "ash/wallpaper/wallpaper_controller_observer.h" |
| 11 #include "base/bind.h" | 11 #include "base/bind.h" |
| 12 #include "base/bind_helpers.h" | 12 #include "base/bind_helpers.h" |
| 13 #include "base/files/file_util.h" | 13 #include "base/files/file_util.h" |
| 14 #include "base/location.h" | 14 #include "base/location.h" |
| 15 #include "base/macros.h" | 15 #include "base/macros.h" |
| 16 #include "base/path_service.h" | 16 #include "base/path_service.h" |
| 17 #include "base/run_loop.h" | 17 #include "base/run_loop.h" |
| 18 #include "base/strings/string_number_conversions.h" | 18 #include "base/strings/string_number_conversions.h" |
| 19 #include "base/strings/string_util.h" | 19 #include "base/strings/string_util.h" |
| 20 #include "base/synchronization/lock.h" | 20 #include "base/synchronization/lock.h" |
| (...skipping 2304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2325 | 2325 |
| 2326 // Private store should serve crx and CWS should not. | 2326 // Private store should serve crx and CWS should not. |
| 2327 DCHECK_GT(private_store.GetUpdateCheckCountAndReset(), 0); | 2327 DCHECK_GT(private_store.GetUpdateCheckCountAndReset(), 0); |
| 2328 DCHECK_EQ(0, fake_cws()->GetUpdateCheckCountAndReset()); | 2328 DCHECK_EQ(0, fake_cws()->GetUpdateCheckCountAndReset()); |
| 2329 EXPECT_EQ(extensions::Manifest::EXTERNAL_POLICY, GetInstalledAppLocation()); | 2329 EXPECT_EQ(extensions::Manifest::EXTERNAL_POLICY, GetInstalledAppLocation()); |
| 2330 } | 2330 } |
| 2331 | 2331 |
| 2332 // Specialized test fixture for testing kiosk mode on the | 2332 // Specialized test fixture for testing kiosk mode on the |
| 2333 // hidden WebUI initialization flow for slow hardware. | 2333 // hidden WebUI initialization flow for slow hardware. |
| 2334 class KioskHiddenWebUITest : public KioskTest, | 2334 class KioskHiddenWebUITest : public KioskTest, |
| 2335 public ash::DesktopBackgroundControllerObserver { | 2335 public ash::WallpaperControllerObserver { |
| 2336 public: | 2336 public: |
| 2337 KioskHiddenWebUITest() : wallpaper_loaded_(false) {} | 2337 KioskHiddenWebUITest() : wallpaper_loaded_(false) {} |
| 2338 | 2338 |
| 2339 // KioskTest overrides: | 2339 // KioskTest overrides: |
| 2340 void SetUpCommandLine(base::CommandLine* command_line) override { | 2340 void SetUpCommandLine(base::CommandLine* command_line) override { |
| 2341 KioskTest::SetUpCommandLine(command_line); | 2341 KioskTest::SetUpCommandLine(command_line); |
| 2342 command_line->AppendSwitch(switches::kDisableBootAnimation); | 2342 command_line->AppendSwitch(switches::kDisableBootAnimation); |
| 2343 } | 2343 } |
| 2344 | 2344 |
| 2345 void SetUpOnMainThread() override { | 2345 void SetUpOnMainThread() override { |
| 2346 LoginDisplayHostImpl::DisableRestrictiveProxyCheckForTest(); | 2346 LoginDisplayHostImpl::DisableRestrictiveProxyCheckForTest(); |
| 2347 | 2347 |
| 2348 KioskTest::SetUpOnMainThread(); | 2348 KioskTest::SetUpOnMainThread(); |
| 2349 ash::Shell::GetInstance()->desktop_background_controller() | 2349 ash::Shell::GetInstance()->wallpaper_controller()->AddObserver(this); |
| 2350 ->AddObserver(this); | |
| 2351 } | 2350 } |
| 2352 | 2351 |
| 2353 void TearDownOnMainThread() override { | 2352 void TearDownOnMainThread() override { |
| 2354 ash::Shell::GetInstance()->desktop_background_controller() | 2353 ash::Shell::GetInstance()->wallpaper_controller()->RemoveObserver(this); |
| 2355 ->RemoveObserver(this); | |
| 2356 KioskTest::TearDownOnMainThread(); | 2354 KioskTest::TearDownOnMainThread(); |
| 2357 } | 2355 } |
| 2358 | 2356 |
| 2359 void WaitForWallpaper() { | 2357 void WaitForWallpaper() { |
| 2360 if (!wallpaper_loaded_) { | 2358 if (!wallpaper_loaded_) { |
| 2361 runner_ = new content::MessageLoopRunner; | 2359 runner_ = new content::MessageLoopRunner; |
| 2362 runner_->Run(); | 2360 runner_->Run(); |
| 2363 } | 2361 } |
| 2364 } | 2362 } |
| 2365 | 2363 |
| 2366 bool wallpaper_loaded() const { return wallpaper_loaded_; } | 2364 bool wallpaper_loaded() const { return wallpaper_loaded_; } |
| 2367 | 2365 |
| 2368 // ash::DesktopBackgroundControllerObserver overrides: | 2366 // ash::WallpaperControllerObserver overrides: |
| 2369 void OnWallpaperDataChanged() override { | 2367 void OnWallpaperDataChanged() override { |
| 2370 wallpaper_loaded_ = true; | 2368 wallpaper_loaded_ = true; |
| 2371 if (runner_.get()) | 2369 if (runner_.get()) |
| 2372 runner_->Quit(); | 2370 runner_->Quit(); |
| 2373 } | 2371 } |
| 2374 | 2372 |
| 2375 bool wallpaper_loaded_; | 2373 bool wallpaper_loaded_; |
| 2376 scoped_refptr<content::MessageLoopRunner> runner_; | 2374 scoped_refptr<content::MessageLoopRunner> runner_; |
| 2377 | 2375 |
| 2378 DISALLOW_COPY_AND_ASSIGN(KioskHiddenWebUITest); | 2376 DISALLOW_COPY_AND_ASSIGN(KioskHiddenWebUITest); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 2403 content::WindowedNotificationObserver( | 2401 content::WindowedNotificationObserver( |
| 2404 chrome::NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_VISIBLE, | 2402 chrome::NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_VISIBLE, |
| 2405 content::NotificationService::AllSources()).Wait(); | 2403 content::NotificationService::AllSources()).Wait(); |
| 2406 | 2404 |
| 2407 // Wait for the wallpaper to load. | 2405 // Wait for the wallpaper to load. |
| 2408 WaitForWallpaper(); | 2406 WaitForWallpaper(); |
| 2409 EXPECT_TRUE(wallpaper_loaded()); | 2407 EXPECT_TRUE(wallpaper_loaded()); |
| 2410 } | 2408 } |
| 2411 | 2409 |
| 2412 } // namespace chromeos | 2410 } // namespace chromeos |
| OLD | NEW |