Don't preload rarely seen large images
[chromium-blink-merge.git] / ash / shell / window_watcher_unittest.cc
blobc3b5dcf2fd533ed3942965955efe0cd05bd3a975
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "ash/shell/window_watcher.h"
7 #include "ash/shell.h"
8 #include "ash/shell/shell_delegate_impl.h"
9 #include "ash/shell_delegate.h"
10 #include "ash/shell_init_params.h"
11 #include "ash/system/user/login_status.h"
12 #include "ash/test/ash_test_base.h"
13 #include "ui/aura/env.h"
14 #include "ui/aura/window_tree_host.h"
16 namespace ash {
18 typedef test::AshTestBase WindowWatcherTest;
20 // This test verifies that shell can be torn down without causing failures
21 // bug http://code.google.com/p/chromium/issues/detail?id=130332
22 TEST_F(WindowWatcherTest, ShellDeleteInstance) {
23 RunAllPendingInMessageLoop();
24 scoped_ptr<ash::shell::WindowWatcher> window_watcher;
25 Shell::DeleteInstance();
27 shell::ShellDelegateImpl* delegate = new ash::shell::ShellDelegateImpl;
28 ash::ShellInitParams init_params;
29 init_params.context_factory = aura::Env::GetInstance()->context_factory();
30 init_params.delegate = delegate;
31 Shell::CreateInstance(init_params);
32 Shell::GetPrimaryRootWindow()->GetHost()->Show();
33 Shell::GetInstance()->CreateShelf();
34 Shell::GetInstance()->UpdateAfterLoginStatusChange(
35 user::LOGGED_IN_USER);
37 window_watcher.reset(new ash::shell::WindowWatcher);
39 delegate->SetWatcher(window_watcher.get());
40 Shell::GetPrimaryRootWindow()->Hide();
41 window_watcher.reset();
42 delegate->SetWatcher(NULL);
45 } // namespace ash