Chromium Code Reviews| Index: ui/gfx/test/test_screen.h |
| diff --git a/ui/mojo/init/screen_mojo.h b/ui/gfx/test/test_screen.h |
| similarity index 62% |
| copy from ui/mojo/init/screen_mojo.h |
| copy to ui/gfx/test/test_screen.h |
| index db7f48f75f9e37d47674162b5ff46b933e53d243..ba5753aaf2196230a67dc0ac0b4c8ecc7e7229cf 100644 |
| --- a/ui/mojo/init/screen_mojo.h |
| +++ b/ui/gfx/test/test_screen.h |
| @@ -2,43 +2,47 @@ |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| -#ifndef UI_MOJO_INIT_SCREEN_MOJO_H_ |
| -#define UI_MOJO_INIT_SCREEN_MOJO_H_ |
| +#include <vector> |
| +#include "base/macros.h" |
| #include "ui/gfx/display.h" |
| -#include "ui/gfx/geometry/size.h" |
| #include "ui/gfx/screen.h" |
| -namespace ui { |
| -namespace mojo { |
| +namespace gfx { |
| +namespace test { |
| -class ScreenMojo : public gfx::Screen { |
| +// A dummy implementation of gfx::Screen that contains a single gfx::Display |
| +// only. The contained gfx::Display can be accessed and modified via |
| +// TestScreen::display(). |
| +// |
| +// NOTE: Adding and removing gfx::DisplayOberver's are no-ops and observers will |
| +// NOT be notified ever. |
| +class TestScreen : public gfx::Screen { |
| public: |
| - ScreenMojo(const gfx::Size& screen_size_in_pixels, float device_pixel_ratio); |
| + TestScreen(); |
| + ~TestScreen() override; |
| + |
| + gfx::Display& display() { return display_; } |
|
Alexei Svitkine (slow)
2015/07/09 15:17:05
I believe non-const refs are discouraged. Return a
bruthig
2015/07/10 15:38:42
Done.
|
| // gfx::Screen: |
| gfx::Point GetCursorScreenPoint() override; |
| gfx::NativeWindow GetWindowUnderCursor() override; |
| gfx::NativeWindow GetWindowAtScreenPoint(const gfx::Point& point) override; |
| - gfx::Display GetPrimaryDisplay() const override; |
| - gfx::Display GetDisplayNearestWindow(gfx::NativeView view) const override; |
| - gfx::Display GetDisplayNearestPoint(const gfx::Point& point) const override; |
| int GetNumDisplays() const override; |
| std::vector<gfx::Display> GetAllDisplays() const override; |
| + gfx::Display GetDisplayNearestWindow(gfx::NativeView view) const override; |
| + gfx::Display GetDisplayNearestPoint(const gfx::Point& point) const override; |
| gfx::Display GetDisplayMatching(const gfx::Rect& match_rect) const override; |
| + gfx::Display GetPrimaryDisplay() const override; |
| void AddObserver(gfx::DisplayObserver* observer) override; |
| void RemoveObserver(gfx::DisplayObserver* observer) override; |
| private: |
| - const gfx::Size screen_size_in_pixels_; |
| - const float device_pixel_ratio_; |
| - |
| + // The only display. |
| gfx::Display display_; |
| - DISALLOW_COPY_AND_ASSIGN(ScreenMojo); |
| + DISALLOW_COPY_AND_ASSIGN(TestScreen); |
| }; |
| -} // namespace mojo |
| -} // namespace ui |
| - |
| -#endif // UI_MOJO_INIT_SCREEN_MOJO_H_ |
| +} // namespace test |
| +} // namespace gfx |