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/ash_switches.h" | 5 #include "ash/ash_switches.h" |
6 #include "ash/launcher/launcher.h" | 6 #include "ash/launcher/launcher.h" |
7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "ash/shell_delegate.h" | 8 #include "ash/shell_delegate.h" |
9 #include "ash/shell_window_ids.h" | 9 #include "ash/shell_window_ids.h" |
10 #include "ash/shell/shell_delegate_impl.h" | |
11 #include "ash/shell/window_watcher.h" | |
10 #include "ash/test/ash_test_base.h" | 12 #include "ash/test/ash_test_base.h" |
11 #include "ash/wm/root_window_layout_manager.h" | 13 #include "ash/wm/root_window_layout_manager.h" |
12 #include "ash/wm/shelf_layout_manager.h" | 14 #include "ash/wm/shelf_layout_manager.h" |
13 #include "base/utf_string_conversions.h" | 15 #include "base/utf_string_conversions.h" |
14 #include "ui/aura/client/aura_constants.h" | 16 #include "ui/aura/client/aura_constants.h" |
15 #include "ui/aura/root_window.h" | 17 #include "ui/aura/root_window.h" |
16 #include "ui/aura/window.h" | 18 #include "ui/aura/window.h" |
17 #include "ui/gfx/size.h" | 19 #include "ui/gfx/size.h" |
18 #include "ui/views/widget/widget.h" | 20 #include "ui/views/widget/widget.h" |
19 #include "ui/views/widget/widget_delegate.h" | 21 #include "ui/views/widget/widget_delegate.h" |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
332 | 334 |
333 private: | 335 private: |
334 DISALLOW_COPY_AND_ASSIGN(ShellTest2); | 336 DISALLOW_COPY_AND_ASSIGN(ShellTest2); |
335 }; | 337 }; |
336 | 338 |
337 TEST_F(ShellTest2, DontCrashWhenWindowDeleted) { | 339 TEST_F(ShellTest2, DontCrashWhenWindowDeleted) { |
338 window_.reset(new aura::Window(NULL)); | 340 window_.reset(new aura::Window(NULL)); |
339 window_->Init(ui::LAYER_NOT_DRAWN); | 341 window_->Init(ui::LAYER_NOT_DRAWN); |
340 } | 342 } |
341 | 343 |
344 #if defined(OS_LINUX) && defined(OS_CHROMEOS) | |
sky
2012/08/06 21:21:22
Why is this specific to linux and chromeos?
Harry McCleave
2012/08/07 18:17:23
Done.
| |
345 class WindowWatcherTest : public test::AshTestBase { | |
sky
2012/08/06 21:21:22
This test is testing WindowWatcher and not so much
Harry McCleave
2012/08/07 18:17:23
Done.
| |
346 public: | |
sky
2012/08/06 21:21:22
nit: spacing is off here, 350 and 353. These shoul
Harry McCleave
2012/08/07 18:17:23
Done.
| |
347 WindowWatcherTest() {} | |
348 virtual ~WindowWatcherTest() {} | |
349 | |
350 protected: | |
351 scoped_ptr<ash::shell::WindowWatcher> window_watcher_; | |
352 | |
353 private: | |
354 DISALLOW_COPY_AND_ASSIGN(WindowWatcherTest); | |
355 }; | |
356 // This test verifies that shell can be torn down without causing failures | |
357 // bug http://code.google.com/p/chromium/issues/detail?id=130332 | |
358 TEST_F(WindowWatcherTest, ShellDeleteInstance) { | |
359 Shell::DeleteInstance(); | |
360 | |
361 shell::ShellDelegateImpl* delegate = new ash::shell::ShellDelegateImpl; | |
362 Shell::CreateInstance(delegate); | |
363 | |
364 Shell::GetPrimaryRootWindow()->ShowRootWindow(); | |
365 window_watcher_.reset(new ash::shell::WindowWatcher); | |
366 | |
367 delegate->SetWatcher(window_watcher_.get()); | |
368 Shell::GetPrimaryRootWindow()->Hide(); | |
369 window_watcher_.reset(); | |
sky
2012/08/06 21:21:22
Don't you need to do a elegate->SetWatcher(NULL) t
Harry McCleave
2012/08/07 18:17:23
Done. Oddly in this case you don't as the desctruc
| |
370 } | |
371 #endif | |
342 } // namespace ash | 372 } // namespace ash |
OLD | NEW |