OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 "ash/shell/window_watcher.h" | 5 #include "ash/shell/window_watcher.h" |
6 | 6 |
7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "ash/shell/shell_delegate_impl.h" | 8 #include "ash/shell/shell_delegate_impl.h" |
9 #include "ash/shell_delegate.h" | 9 #include "ash/shell_delegate.h" |
10 #include "ash/shell_init_params.h" | 10 #include "ash/shell_init_params.h" |
11 #include "ash/system/user/login_status.h" | 11 #include "ash/system/user/login_status.h" |
12 #include "ash/test/ash_test_base.h" | 12 #include "ash/test/ash_test_base.h" |
13 #include "ui/aura/window_tree_host.h" | 13 #include "ui/aura/window_tree_host.h" |
14 | 14 |
15 namespace ash { | 15 namespace ash { |
16 | 16 |
17 typedef test::AshTestBase WindowWatcherTest; | 17 typedef test::AshTestBase WindowWatcherTest; |
18 | 18 |
19 // This test verifies that shell can be torn down without causing failures | 19 // This test verifies that shell can be torn down without causing failures |
20 // bug http://code.google.com/p/chromium/issues/detail?id=130332 | 20 // bug http://code.google.com/p/chromium/issues/detail?id=130332 |
21 TEST_F(WindowWatcherTest, ShellDeleteInstance) { | 21 TEST_F(WindowWatcherTest, ShellDeleteInstance) { |
22 RunAllPendingInMessageLoop(); | 22 RunAllPendingInMessageLoop(); |
23 scoped_ptr<ash::shell::WindowWatcher> window_watcher; | 23 scoped_ptr<ash::shell::WindowWatcher> window_watcher; |
24 Shell::DeleteInstance(); | 24 Shell::DeleteInstance(); |
25 | 25 |
26 shell::ShellDelegateImpl* delegate = new ash::shell::ShellDelegateImpl; | 26 shell::ShellDelegateImpl* delegate = new ash::shell::ShellDelegateImpl; |
27 ash::ShellInitParams init_params; | 27 ash::ShellInitParams init_params; |
| 28 init_params.context_factory = context_factory(); |
28 init_params.delegate = delegate; | 29 init_params.delegate = delegate; |
29 Shell::CreateInstance(init_params); | 30 Shell::CreateInstance(init_params); |
30 Shell::GetPrimaryRootWindow()->GetHost()->Show(); | 31 Shell::GetPrimaryRootWindow()->GetHost()->Show(); |
31 Shell::GetInstance()->CreateShelf(); | 32 Shell::GetInstance()->CreateShelf(); |
32 Shell::GetInstance()->UpdateAfterLoginStatusChange( | 33 Shell::GetInstance()->UpdateAfterLoginStatusChange( |
33 user::LOGGED_IN_USER); | 34 user::LOGGED_IN_USER); |
34 | 35 |
35 window_watcher.reset(new ash::shell::WindowWatcher); | 36 window_watcher.reset(new ash::shell::WindowWatcher); |
36 | 37 |
37 delegate->SetWatcher(window_watcher.get()); | 38 delegate->SetWatcher(window_watcher.get()); |
38 Shell::GetPrimaryRootWindow()->Hide(); | 39 Shell::GetPrimaryRootWindow()->Hide(); |
39 window_watcher.reset(); | 40 window_watcher.reset(); |
40 delegate->SetWatcher(NULL); | 41 delegate->SetWatcher(NULL); |
41 } | 42 } |
42 | 43 |
43 } // namespace ash | 44 } // namespace ash |
OLD | NEW |