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

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

Issue 37733003: Make GetRootWindow() return a Window instead of a RootWindow. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 1 month 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 | « ash/test/ash_test_base.h ('k') | ash/test/ash_test_helper.h » ('j') | 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/ash_switches.h" 10 #include "ash/ash_switches.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 public: 53 public:
54 AshEventGeneratorDelegate() {} 54 AshEventGeneratorDelegate() {}
55 virtual ~AshEventGeneratorDelegate() {} 55 virtual ~AshEventGeneratorDelegate() {}
56 56
57 // aura::test::EventGeneratorDelegate overrides: 57 // aura::test::EventGeneratorDelegate overrides:
58 virtual aura::RootWindow* GetRootWindowAt( 58 virtual aura::RootWindow* GetRootWindowAt(
59 const gfx::Point& point_in_screen) const OVERRIDE { 59 const gfx::Point& point_in_screen) const OVERRIDE {
60 gfx::Screen* screen = Shell::GetScreen(); 60 gfx::Screen* screen = Shell::GetScreen();
61 gfx::Display display = screen->GetDisplayNearestPoint(point_in_screen); 61 gfx::Display display = screen->GetDisplayNearestPoint(point_in_screen);
62 return Shell::GetInstance()->display_controller()-> 62 return Shell::GetInstance()->display_controller()->
63 GetRootWindowForDisplayId(display.id()); 63 GetRootWindowForDisplayId(display.id())->GetDispatcher();
64 } 64 }
65 65
66 virtual aura::client::ScreenPositionClient* GetScreenPositionClient( 66 virtual aura::client::ScreenPositionClient* GetScreenPositionClient(
67 const aura::Window* window) const OVERRIDE { 67 const aura::Window* window) const OVERRIDE {
68 return aura::client::GetScreenPositionClient(window->GetRootWindow()); 68 return aura::client::GetScreenPositionClient(window->GetRootWindow());
69 } 69 }
70 70
71 private: 71 private:
72 DISALLOW_COPY_AND_ASSIGN(AshEventGeneratorDelegate); 72 DISALLOW_COPY_AND_ASSIGN(AshEventGeneratorDelegate);
73 }; 73 };
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 if (!command_line->HasSwitch(switches::kAshHostWindowBounds)) { 108 if (!command_line->HasSwitch(switches::kAshHostWindowBounds)) {
109 command_line->AppendSwitchASCII( 109 command_line->AppendSwitchASCII(
110 switches::kAshHostWindowBounds, "1+1-800x600"); 110 switches::kAshHostWindowBounds, "1+1-800x600");
111 } 111 }
112 #if defined(OS_WIN) 112 #if defined(OS_WIN)
113 aura::test::SetUsePopupAsRootWindowForTest(true); 113 aura::test::SetUsePopupAsRootWindowForTest(true);
114 #endif 114 #endif
115 ash_test_helper_->SetUp(start_session_); 115 ash_test_helper_->SetUp(start_session_);
116 116
117 Shell::GetPrimaryRootWindow()->Show(); 117 Shell::GetPrimaryRootWindow()->Show();
118 Shell::GetPrimaryRootWindow()->ShowRootWindow(); 118 Shell::GetPrimaryRootWindow()->GetDispatcher()->ShowRootWindow();
119 // Move the mouse cursor to far away so that native events doesn't 119 // Move the mouse cursor to far away so that native events doesn't
120 // interfere test expectations. 120 // interfere test expectations.
121 Shell::GetPrimaryRootWindow()->MoveCursorTo(gfx::Point(-1000, -1000)); 121 Shell::GetPrimaryRootWindow()->MoveCursorTo(gfx::Point(-1000, -1000));
122 ash::Shell::GetInstance()->cursor_manager()->EnableMouseEvents(); 122 ash::Shell::GetInstance()->cursor_manager()->EnableMouseEvents();
123 123
124 #if defined(OS_WIN) 124 #if defined(OS_WIN)
125 if (base::win::GetVersion() >= base::win::VERSION_WIN8 && 125 if (base::win::GetVersion() >= base::win::VERSION_WIN8 &&
126 !command_line->HasSwitch(ash::switches::kForceAshToDesktop)) { 126 !command_line->HasSwitch(ash::switches::kForceAshToDesktop)) {
127 ipc_thread_.reset(new base::Thread("test_metro_viewer_ipc_thread")); 127 ipc_thread_.reset(new base::Thread("test_metro_viewer_ipc_thread"));
128 base::Thread::Options options; 128 base::Thread::Options options;
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 return true; 200 return true;
201 #endif 201 #endif
202 } 202 }
203 203
204 void AshTestBase::UpdateDisplay(const std::string& display_specs) { 204 void AshTestBase::UpdateDisplay(const std::string& display_specs) {
205 DisplayManagerTestApi display_manager_test_api( 205 DisplayManagerTestApi display_manager_test_api(
206 Shell::GetInstance()->display_manager()); 206 Shell::GetInstance()->display_manager());
207 display_manager_test_api.UpdateDisplay(display_specs); 207 display_manager_test_api.UpdateDisplay(display_specs);
208 } 208 }
209 209
210 aura::RootWindow* AshTestBase::CurrentContext() { 210 aura::Window* AshTestBase::CurrentContext() {
211 return ash_test_helper_->CurrentContext(); 211 return ash_test_helper_->CurrentContext();
212 } 212 }
213 213
214 aura::Window* AshTestBase::CreateTestWindowInShellWithId(int id) { 214 aura::Window* AshTestBase::CreateTestWindowInShellWithId(int id) {
215 return CreateTestWindowInShellWithDelegate(NULL, id, gfx::Rect()); 215 return CreateTestWindowInShellWithDelegate(NULL, id, gfx::Rect());
216 } 216 }
217 217
218 aura::Window* AshTestBase::CreateTestWindowInShellWithBounds( 218 aura::Window* AshTestBase::CreateTestWindowInShellWithBounds(
219 const gfx::Rect& bounds) { 219 const gfx::Rect& bounds) {
220 return CreateTestWindowInShellWithDelegate(NULL, 0, bounds); 220 return CreateTestWindowInShellWithDelegate(NULL, 0, bounds);
(...skipping 26 matching lines...) Expand all
247 window->set_id(id); 247 window->set_id(id);
248 window->SetType(type); 248 window->SetType(type);
249 window->Init(ui::LAYER_TEXTURED); 249 window->Init(ui::LAYER_TEXTURED);
250 window->Show(); 250 window->Show();
251 251
252 if (bounds.IsEmpty()) { 252 if (bounds.IsEmpty()) {
253 ParentWindowInPrimaryRootWindow(window); 253 ParentWindowInPrimaryRootWindow(window);
254 } else { 254 } else {
255 gfx::Display display = 255 gfx::Display display =
256 Shell::GetScreen()->GetDisplayMatching(bounds); 256 Shell::GetScreen()->GetDisplayMatching(bounds);
257 aura::RootWindow* root = ash::Shell::GetInstance()->display_controller()-> 257 aura::Window* root = ash::Shell::GetInstance()->display_controller()->
258 GetRootWindowForDisplayId(display.id()); 258 GetRootWindowForDisplayId(display.id());
259 gfx::Point origin = bounds.origin(); 259 gfx::Point origin = bounds.origin();
260 wm::ConvertPointFromScreen(root, &origin); 260 wm::ConvertPointFromScreen(root, &origin);
261 window->SetBounds(gfx::Rect(origin, bounds.size())); 261 window->SetBounds(gfx::Rect(origin, bounds.size()));
262 aura::client::ParentWindowWithContext(window, root, bounds); 262 aura::client::ParentWindowWithContext(window, root, bounds);
263 } 263 }
264 window->SetProperty(aura::client::kCanMaximizeKey, true); 264 window->SetProperty(aura::client::kCanMaximizeKey, true);
265 return window; 265 return window;
266 } 266 }
267 267
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 321
322 void AshTestBase::UnblockUserSession() { 322 void AshTestBase::UnblockUserSession() {
323 Shell::GetInstance()->session_state_delegate()->UnlockScreen(); 323 Shell::GetInstance()->session_state_delegate()->UnlockScreen();
324 SetSessionStarted(true); 324 SetSessionStarted(true);
325 SetUserAddingScreenRunning(false); 325 SetUserAddingScreenRunning(false);
326 } 326 }
327 327
328 328
329 } // namespace test 329 } // namespace test
330 } // namespace ash 330 } // namespace ash
OLDNEW
« no previous file with comments | « ash/test/ash_test_base.h ('k') | ash/test/ash_test_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698