test_screen.cc revision 5821806d5e7f356e8fa4b058a389a808ea183019
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 3// found in the LICENSE file. 4 5#include "ui/aura/test/test_screen.h" 6 7#include "base/logging.h" 8#include "ui/aura/env.h" 9#include "ui/aura/root_window.h" 10#include "ui/aura/window.h" 11#include "ui/gfx/native_widget_types.h" 12#include "ui/gfx/screen.h" 13 14namespace aura { 15 16TestScreen::TestScreen(aura::RootWindow* root_window) 17 : root_window_(root_window) { 18} 19 20TestScreen::~TestScreen() { 21} 22 23bool TestScreen::IsDIPEnabled() { 24 return true; 25} 26 27gfx::Point TestScreen::GetCursorScreenPoint() { 28 return Env::GetInstance()->last_mouse_location(); 29} 30 31gfx::NativeWindow TestScreen::GetWindowAtCursorScreenPoint() { 32 const gfx::Point point = GetCursorScreenPoint(); 33 return root_window_->GetTopWindowContainingPoint(point); 34} 35 36int TestScreen::GetNumDisplays() { 37 return 1; 38} 39 40gfx::Display TestScreen::GetDisplayNearestWindow( 41 gfx::NativeWindow window) const { 42 return GetMonitor(); 43} 44 45gfx::Display TestScreen::GetDisplayNearestPoint(const gfx::Point& point) const { 46 return GetMonitor(); 47} 48 49gfx::Display TestScreen::GetDisplayMatching(const gfx::Rect& match_rect) const { 50 return GetMonitor(); 51} 52 53gfx::Display TestScreen::GetPrimaryDisplay() const { 54 return GetMonitor(); 55} 56 57gfx::Display TestScreen::GetMonitor() const { 58 return gfx::Display(0, root_window_->bounds()); 59} 60 61} // namespace aura 62