Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(376)

Side by Side Diff: ash/test/ash_test_base.cc

Issue 11412259: Show rootwindow in ash test (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/test/ash_test_base.h" 5 #include "ash/test/ash_test_base.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "ash/display/display_controller.h" 10 #include "ash/display/display_controller.h"
11 #include "ash/display/display_manager.h" 11 #include "ash/display/display_manager.h"
12 #include "ash/shell.h" 12 #include "ash/shell.h"
13 #include "ash/test/display_manager_test_api.h" 13 #include "ash/test/display_manager_test_api.h"
14 #include "ash/test/test_shell_delegate.h" 14 #include "ash/test/test_shell_delegate.h"
15 #include "base/command_line.h"
15 #include "base/run_loop.h" 16 #include "base/run_loop.h"
16 #include "content/public/test/web_contents_tester.h" 17 #include "content/public/test/web_contents_tester.h"
18 #include "ui/aura/aura_switches.h"
17 #include "ui/aura/client/aura_constants.h" 19 #include "ui/aura/client/aura_constants.h"
18 #include "ui/aura/env.h" 20 #include "ui/aura/env.h"
19 #include "ui/aura/root_window.h" 21 #include "ui/aura/root_window.h"
20 #include "ui/aura/test/test_window_delegate.h" 22 #include "ui/aura/test/test_window_delegate.h"
21 #include "ui/aura/window_delegate.h" 23 #include "ui/aura/window_delegate.h"
22 #include "ui/base/ime/text_input_test_support.h" 24 #include "ui/base/ime/text_input_test_support.h"
23 #include "ui/compositor/layer_animator.h" 25 #include "ui/compositor/layer_animator.h"
24 #include "ui/gfx/display.h" 26 #include "ui/gfx/display.h"
25 #include "ui/gfx/screen.h" 27 #include "ui/gfx/screen.h"
26 28
27 namespace ash { 29 namespace ash {
28 namespace test { 30 namespace test {
29 31
30 content::WebContents* AshTestViewsDelegate::CreateWebContents( 32 content::WebContents* AshTestViewsDelegate::CreateWebContents(
31 content::BrowserContext* browser_context, 33 content::BrowserContext* browser_context,
32 content::SiteInstance* site_instance) { 34 content::SiteInstance* site_instance) {
33 return content::WebContentsTester::CreateTestWebContents(browser_context, 35 return content::WebContentsTester::CreateTestWebContents(browser_context,
34 site_instance); 36 site_instance);
35 } 37 }
36 38
37 AshTestBase::AshTestBase() : test_shell_delegate_(NULL) { 39 AshTestBase::AshTestBase() : test_shell_delegate_(NULL) {
38 } 40 }
39 41
40 AshTestBase::~AshTestBase() { 42 AshTestBase::~AshTestBase() {
41 } 43 }
42 44
43 void AshTestBase::SetUp() { 45 void AshTestBase::SetUp() {
46 CommandLine::ForCurrentProcess()->AppendSwitchASCII(
47 switches::kAuraHostWindowSize, "0+0-800x600");
44 // Disable animations during tests. 48 // Disable animations during tests.
45 ui::LayerAnimator::set_disable_animations_for_test(true); 49 ui::LayerAnimator::set_disable_animations_for_test(true);
46 ui::TextInputTestSupport::Initialize(); 50 ui::TextInputTestSupport::Initialize();
47 // Creates Shell and hook with Desktop. 51 // Creates Shell and hook with Desktop.
48 test_shell_delegate_ = new TestShellDelegate; 52 test_shell_delegate_ = new TestShellDelegate;
49 ash::Shell::CreateInstance(test_shell_delegate_); 53 ash::Shell::CreateInstance(test_shell_delegate_);
50 Shell::GetPrimaryRootWindow()->Show(); 54 Shell::GetPrimaryRootWindow()->Show();
55 Shell::GetPrimaryRootWindow()->ShowRootWindow();
51 // Move the mouse cursor to far away so that native events doesn't 56 // Move the mouse cursor to far away so that native events doesn't
52 // interfere test expectations. 57 // interfere test expectations.
53 Shell::GetPrimaryRootWindow()->MoveCursorTo(gfx::Point(-1000, -1000)); 58 Shell::GetPrimaryRootWindow()->MoveCursorTo(gfx::Point(-1000, -1000));
54 UpdateDisplay("800x600");
55 Shell::GetInstance()->cursor_manager()->ShowCursor(true); 59 Shell::GetInstance()->cursor_manager()->ShowCursor(true);
56 } 60 }
57 61
58 void AshTestBase::TearDown() { 62 void AshTestBase::TearDown() {
59 // Flush the message loop to finish pending release tasks. 63 // Flush the message loop to finish pending release tasks.
60 RunAllPendingInMessageLoop(); 64 RunAllPendingInMessageLoop();
61 65
62 // Tear down the shell. 66 // Tear down the shell.
63 Shell::DeleteInstance(); 67 Shell::DeleteInstance();
64 aura::Env::DeleteInstance(); 68 aura::Env::DeleteInstance();
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 void AshTestBase::SetUserLoggedIn(bool user_logged_in) { 148 void AshTestBase::SetUserLoggedIn(bool user_logged_in) {
145 test_shell_delegate_->SetUserLoggedIn(user_logged_in); 149 test_shell_delegate_->SetUserLoggedIn(user_logged_in);
146 } 150 }
147 151
148 void AshTestBase::SetCanLockScreen(bool can_lock_screen) { 152 void AshTestBase::SetCanLockScreen(bool can_lock_screen) {
149 test_shell_delegate_->SetCanLockScreen(can_lock_screen); 153 test_shell_delegate_->SetCanLockScreen(can_lock_screen);
150 } 154 }
151 155
152 } // namespace test 156 } // namespace test
153 } // namespace ash 157 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698