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

Unified Diff: ash/test/ash_test_base.cc

Issue 11825015: [Cleanup] consolidate DISABLED macros in mouse_cursor_event_filter_unittests.cc (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/test/ash_test_base.h ('k') | ash/wm/activation_controller_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/test/ash_test_base.cc
diff --git a/ash/test/ash_test_base.cc b/ash/test/ash_test_base.cc
index cedb895f26774bcddc8f114cfe8cf9f65244f03e..0bd7bbb538ce82e07943d825f63f4fe5ac387c6f 100644
--- a/ash/test/ash_test_base.cc
+++ b/ash/test/ash_test_base.cc
@@ -9,6 +9,7 @@
#include "ash/display/display_controller.h"
#include "ash/display/display_manager.h"
+#include "ash/screen_ash.h"
#include "ash/shell.h"
#include "ash/test/display_manager_test_api.h"
#include "ash/test/test_shell_delegate.h"
@@ -18,8 +19,10 @@
#include "content/public/test/web_contents_tester.h"
#include "ui/aura/aura_switches.h"
#include "ui/aura/client/aura_constants.h"
+#include "ui/aura/client/screen_position_client.h"
#include "ui/aura/env.h"
#include "ui/aura/root_window.h"
+#include "ui/aura/test/event_generator.h"
#include "ui/aura/test/test_window_delegate.h"
#include "ui/aura/window_delegate.h"
#include "ui/base/ime/text_input_test_support.h"
@@ -33,6 +36,32 @@
namespace ash {
namespace test {
+namespace {
+
+class AshEventGeneratorDelegate : public aura::test::EventGeneratorDelegate {
+ public:
+ AshEventGeneratorDelegate() {}
+ virtual ~AshEventGeneratorDelegate() {}
+
+ // aura::test::EventGeneratorDelegate overrides:
+ aura::RootWindow* GetRootWindowAt(
+ const gfx::Point& point_in_screen) const OVERRIDE {
+ gfx::Screen* screen = Shell::GetInstance()->screen();
+ gfx::Display display = screen->GetDisplayNearestPoint(point_in_screen);
+ return Shell::GetInstance()->display_controller()->
+ GetRootWindowForDisplayId(display.id());
+ }
+
+ aura::client::ScreenPositionClient* GetScreenPositionClient(
+ const aura::Window* window) const OVERRIDE {
+ return aura::client::GetScreenPositionClient(window->GetRootWindow());
+ }
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(AshEventGeneratorDelegate);
+};
+
+} // namespace
content::WebContents* AshTestViewsDelegate::CreateWebContents(
content::BrowserContext* browser_context,
@@ -41,7 +70,8 @@ content::WebContents* AshTestViewsDelegate::CreateWebContents(
site_instance);
}
-AshTestBase::AshTestBase() : test_shell_delegate_(NULL) {
+AshTestBase::AshTestBase()
+ : test_shell_delegate_(NULL) {
}
AshTestBase::~AshTestBase() {
@@ -80,6 +110,15 @@ void AshTestBase::TearDown() {
#if defined(OS_WIN)
aura::test::SetUsePopupAsRootWindowForTest(false);
#endif
+ event_generator_.reset();
+}
+
+aura::test::EventGenerator& AshTestBase::GetEventGenerator() {
+ if (!event_generator_.get()) {
+ event_generator_.reset(
+ new aura::test::EventGenerator(new AshEventGeneratorDelegate()));
+ }
+ return *event_generator_.get();
}
void AshTestBase::ChangeDisplayConfig(float scale,
« no previous file with comments | « ash/test/ash_test_base.h ('k') | ash/wm/activation_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698