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

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

Issue 322893005: MacViews: Add WidgetEventGenerator to abstract platform-specific event generation for tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: No inheritance Created 6 years, 5 months 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
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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 #endif 48 #endif
49 49
50 #if defined(USE_X11) 50 #if defined(USE_X11)
51 #include "ui/gfx/x/x11_connection.h" 51 #include "ui/gfx/x/x11_connection.h"
52 #endif 52 #endif
53 53
54 namespace ash { 54 namespace ash {
55 namespace test { 55 namespace test {
56 namespace { 56 namespace {
57 57
58 class AshEventGeneratorDelegate : public aura::test::EventGeneratorDelegate { 58 class AshEventGeneratorDelegate
59 : public aura::test::EventGeneratorDelegateAura {
59 public: 60 public:
60 AshEventGeneratorDelegate() {} 61 AshEventGeneratorDelegate() {}
61 virtual ~AshEventGeneratorDelegate() {} 62 virtual ~AshEventGeneratorDelegate() {}
62 63
63 // aura::test::EventGeneratorDelegate overrides: 64 // aura::test::EventGeneratorDelegateAura overrides:
64 virtual aura::WindowTreeHost* GetHostAt( 65 virtual aura::WindowTreeHost* GetHostAt(
65 const gfx::Point& point_in_screen) const OVERRIDE { 66 const gfx::Point& point_in_screen) const OVERRIDE {
66 gfx::Screen* screen = Shell::GetScreen(); 67 gfx::Screen* screen = Shell::GetScreen();
67 gfx::Display display = screen->GetDisplayNearestPoint(point_in_screen); 68 gfx::Display display = screen->GetDisplayNearestPoint(point_in_screen);
68 return Shell::GetInstance()->display_controller()-> 69 return Shell::GetInstance()->display_controller()->
69 GetRootWindowForDisplayId(display.id())->GetHost(); 70 GetRootWindowForDisplayId(display.id())->GetHost();
70 } 71 }
71 72
72 virtual aura::client::ScreenPositionClient* GetScreenPositionClient( 73 virtual aura::client::ScreenPositionClient* GetScreenPositionClient(
73 const aura::Window* window) const OVERRIDE { 74 const aura::Window* window) const OVERRIDE {
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 base::KillAllNamedProcessesWithArgument(win8::test::kDefaultTestExePath, 185 base::KillAllNamedProcessesWithArgument(win8::test::kDefaultTestExePath,
185 kViewerProcessArgument); 186 kViewerProcessArgument);
186 #endif 187 #endif
187 188
188 event_generator_.reset(); 189 event_generator_.reset();
189 // Some tests set an internal display id, 190 // Some tests set an internal display id,
190 // reset it here, so other tests will continue in a clean environment. 191 // reset it here, so other tests will continue in a clean environment.
191 gfx::Display::SetInternalDisplayId(gfx::Display::kInvalidDisplayID); 192 gfx::Display::SetInternalDisplayId(gfx::Display::kInvalidDisplayID);
192 } 193 }
193 194
194 aura::test::EventGenerator& AshTestBase::GetEventGenerator() { 195 ui::test::EventGenerator& AshTestBase::GetEventGenerator() {
195 if (!event_generator_) { 196 if (!event_generator_) {
196 event_generator_.reset( 197 event_generator_.reset(
197 new aura::test::EventGenerator(new AshEventGeneratorDelegate())); 198 new ui::test::EventGenerator(new AshEventGeneratorDelegate()));
198 } 199 }
199 return *event_generator_.get(); 200 return *event_generator_.get();
200 } 201 }
201 202
202 bool AshTestBase::SupportsMultipleDisplays() { 203 bool AshTestBase::SupportsMultipleDisplays() {
203 return AshTestHelper::SupportsMultipleDisplays(); 204 return AshTestHelper::SupportsMultipleDisplays();
204 } 205 }
205 206
206 bool AshTestBase::SupportsHostWindowResize() { 207 bool AshTestBase::SupportsHostWindowResize() {
207 return AshTestHelper::SupportsHostWindowResize(); 208 return AshTestHelper::SupportsHostWindowResize();
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 335
335 void AshTestBase::UnblockUserSession() { 336 void AshTestBase::UnblockUserSession() {
336 Shell::GetInstance()->session_state_delegate()->UnlockScreen(); 337 Shell::GetInstance()->session_state_delegate()->UnlockScreen();
337 SetSessionStarted(true); 338 SetSessionStarted(true);
338 SetUserAddingScreenRunning(false); 339 SetUserAddingScreenRunning(false);
339 } 340 }
340 341
341 342
342 } // namespace test 343 } // namespace test
343 } // namespace ash 344 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698