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

Unified Diff: ash/display/window_tree_host_manager_unittest.cc

Issue 1924703002: Rename gfx::Display/Screen to display::Display/Screen in ash (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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/display/window_tree_host_manager.cc ('k') | ash/drag_drop/drag_drop_tracker.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/display/window_tree_host_manager_unittest.cc
diff --git a/ash/display/window_tree_host_manager_unittest.cc b/ash/display/window_tree_host_manager_unittest.cc
index b49709f84c08cd26cf876a92ccfa2a11e3516c8b..a1df9c65a948f2236a81ccf71f6fed317caf027c 100644
--- a/ash/display/window_tree_host_manager_unittest.cc
+++ b/ash/display/window_tree_host_manager_unittest.cc
@@ -30,11 +30,12 @@
#include "ui/aura/window_observer.h"
#include "ui/aura/window_tracker.h"
#include "ui/aura/window_tree_host.h"
+#include "ui/display/display.h"
+#include "ui/display/display_observer.h"
#include "ui/display/manager/display_layout.h"
+#include "ui/display/screen.h"
#include "ui/events/event_handler.h"
#include "ui/events/test/event_generator.h"
-#include "ui/gfx/display.h"
-#include "ui/gfx/screen.h"
#include "ui/views/mouse_watcher.h"
#include "ui/views/mouse_watcher_view_host.h"
#include "ui/views/view.h"
@@ -60,7 +61,7 @@ class Resetter {
};
class TestObserver : public WindowTreeHostManager::Observer,
- public gfx::DisplayObserver,
+ public display::DisplayObserver,
public aura::client::FocusChangeObserver,
public aura::client::ActivationChangeObserver {
public:
@@ -75,7 +76,7 @@ class TestObserver : public WindowTreeHostManager::Observer,
focus_changed_count_(0),
activation_changed_count_(0) {
Shell::GetInstance()->window_tree_host_manager()->AddObserver(this);
- gfx::Screen::GetScreen()->AddObserver(this);
+ display::Screen::GetScreen()->AddObserver(this);
aura::client::GetFocusClient(Shell::GetPrimaryRootWindow())
->AddObserver(this);
aura::client::GetActivationClient(Shell::GetPrimaryRootWindow())
@@ -84,7 +85,7 @@ class TestObserver : public WindowTreeHostManager::Observer,
~TestObserver() override {
Shell::GetInstance()->window_tree_host_manager()->RemoveObserver(this);
- gfx::Screen::GetScreen()->RemoveObserver(this);
+ display::Screen::GetScreen()->RemoveObserver(this);
aura::client::GetFocusClient(Shell::GetPrimaryRootWindow())
->RemoveObserver(this);
aura::client::GetActivationClient(Shell::GetPrimaryRootWindow())
@@ -95,8 +96,8 @@ class TestObserver : public WindowTreeHostManager::Observer,
void OnDisplayConfigurationChanging() override { ++changing_count_; }
void OnDisplayConfigurationChanged() override { ++changed_count_; }
- // Overrideen from gfx::DisplayObserver
- void OnDisplayMetricsChanged(const gfx::Display& display,
+ // Overrideen from display::DisplayObserver
+ void OnDisplayMetricsChanged(const display::Display& display,
uint32_t metrics) override {
changed_display_id_ = display.id();
if (metrics & DISPLAY_METRIC_BOUNDS)
@@ -108,8 +109,8 @@ class TestObserver : public WindowTreeHostManager::Observer,
if (metrics & DISPLAY_METRIC_PRIMARY)
++primary_changed_count_;
}
- void OnDisplayAdded(const gfx::Display& new_display) override {}
- void OnDisplayRemoved(const gfx::Display& old_display) override {}
+ void OnDisplayAdded(const display::Display& new_display) override {}
+ void OnDisplayRemoved(const display::Display& old_display) override {}
// Overridden from aura::client::FocusChangeObserver
void OnWindowFocused(aura::Window* gained_focus,
@@ -177,13 +178,13 @@ class TestObserver : public WindowTreeHostManager::Observer,
DISALLOW_COPY_AND_ASSIGN(TestObserver);
};
-gfx::Display GetPrimaryDisplay() {
- return gfx::Screen::GetScreen()->GetDisplayNearestWindow(
+display::Display GetPrimaryDisplay() {
+ return display::Screen::GetScreen()->GetDisplayNearestWindow(
Shell::GetAllRootWindows()[0]);
}
-gfx::Display GetSecondaryDisplay() {
- return gfx::Screen::GetScreen()->GetDisplayNearestWindow(
+display::Display GetSecondaryDisplay() {
+ return display::Screen::GetScreen()->GetDisplayNearestWindow(
Shell::GetAllRootWindows()[1]);
}
@@ -192,7 +193,7 @@ void SetSecondaryDisplayLayoutAndOffset(
int offset) {
std::unique_ptr<display::DisplayLayout> layout(
test::CreateDisplayLayout(position, offset));
- ASSERT_GT(gfx::Screen::GetScreen()->GetNumDisplays(), 1);
+ ASSERT_GT(display::Screen::GetScreen()->GetNumDisplays(), 1);
Shell::GetInstance()->display_manager()->SetLayoutForCurrentDisplays(
std::move(layout));
}
@@ -221,9 +222,10 @@ class WindowTreeHostManagerShutdownTest : public test::AshTestBase {
return;
// Make sure that primary display is accessible after shutdown.
- gfx::Display primary = gfx::Screen::GetScreen()->GetPrimaryDisplay();
+ display::Display primary =
+ display::Screen::GetScreen()->GetPrimaryDisplay();
EXPECT_EQ("0,0 444x333", primary.bounds().ToString());
- EXPECT_EQ(2, gfx::Screen::GetScreen()->GetNumDisplays());
+ EXPECT_EQ(2, display::Screen::GetScreen()->GetNumDisplays());
}
private:
@@ -541,15 +543,15 @@ namespace {
DisplayInfo CreateDisplayInfo(int64_t id,
int y,
- gfx::Display::Rotation rotation) {
+ display::Display::Rotation rotation) {
DisplayInfo info(id, "", false);
info.SetBounds(gfx::Rect(0, y, 500, 500));
- info.SetRotation(rotation, gfx::Display::ROTATION_SOURCE_ACTIVE);
+ info.SetRotation(rotation, display::Display::ROTATION_SOURCE_ACTIVE);
return info;
}
DisplayInfo CreateMirroredDisplayInfo(int64_t id, float device_scale_factor) {
- DisplayInfo info = CreateDisplayInfo(id, 0, gfx::Display::ROTATE_0);
+ DisplayInfo info = CreateDisplayInfo(id, 0, display::Display::ROTATE_0);
info.set_device_scale_factor(device_scale_factor);
return info;
}
@@ -649,13 +651,13 @@ TEST_F(WindowTreeHostManagerTest, BoundsUpdated) {
EXPECT_LE(1, observer.GetFocusChangedCountAndReset());
EXPECT_LE(1, observer.GetActivationChangedCountAndReset());
EXPECT_EQ("0,0 400x400", GetPrimaryDisplay().bounds().ToString());
- EXPECT_EQ(1, gfx::Screen::GetScreen()->GetNumDisplays());
+ EXPECT_EQ(1, display::Screen::GetScreen()->GetNumDisplays());
UpdateDisplay("400x500*2,300x300");
EXPECT_EQ(1, observer.CountAndReset());
EXPECT_EQ(0, observer.GetFocusChangedCountAndReset());
EXPECT_EQ(0, observer.GetActivationChangedCountAndReset());
- ASSERT_EQ(2, gfx::Screen::GetScreen()->GetNumDisplays());
+ ASSERT_EQ(2, display::Screen::GetScreen()->GetNumDisplays());
EXPECT_EQ("0,0 200x250", GetPrimaryDisplay().bounds().ToString());
EXPECT_EQ("0,250 300x300", GetSecondaryDisplay().bounds().ToString());
@@ -669,14 +671,14 @@ TEST_F(WindowTreeHostManagerTest, BoundsUpdated) {
// Rotation
observer.GetRotationChangedCountAndReset(); // we only want to reset.
int64_t primary_id = GetPrimaryDisplay().id();
- display_manager->SetDisplayRotation(primary_id, gfx::Display::ROTATE_90,
- gfx::Display::ROTATION_SOURCE_ACTIVE);
+ display_manager->SetDisplayRotation(primary_id, display::Display::ROTATE_90,
+ display::Display::ROTATION_SOURCE_ACTIVE);
EXPECT_EQ(1, observer.GetRotationChangedCountAndReset());
EXPECT_EQ(1, observer.CountAndReset());
EXPECT_EQ(0, observer.GetFocusChangedCountAndReset());
EXPECT_EQ(0, observer.GetActivationChangedCountAndReset());
- display_manager->SetDisplayRotation(primary_id, gfx::Display::ROTATE_90,
- gfx::Display::ROTATION_SOURCE_ACTIVE);
+ display_manager->SetDisplayRotation(primary_id, display::Display::ROTATE_90,
+ display::Display::ROTATION_SOURCE_ACTIVE);
EXPECT_EQ(0, observer.GetRotationChangedCountAndReset());
EXPECT_EQ(0, observer.CountAndReset());
EXPECT_EQ(0, observer.GetFocusChangedCountAndReset());
@@ -725,8 +727,9 @@ TEST_F(WindowTreeHostManagerTest, FindNearestDisplay) {
display_manager->SetLayoutForCurrentDisplays(
test::CreateDisplayLayout(display::DisplayPlacement::RIGHT, 50));
- gfx::Display primary_display = gfx::Screen::GetScreen()->GetPrimaryDisplay();
- gfx::Display secondary_display = ScreenUtil::GetSecondaryDisplay();
+ display::Display primary_display =
+ display::Screen::GetScreen()->GetPrimaryDisplay();
+ display::Display secondary_display = ScreenUtil::GetSecondaryDisplay();
EXPECT_NE(primary_display.id(), secondary_display.id());
aura::Window* primary_root =
window_tree_host_manager->GetRootWindowForDisplayId(primary_display.id());
@@ -737,39 +740,39 @@ TEST_F(WindowTreeHostManagerTest, FindNearestDisplay) {
// Test that points outside of any display return the nearest display.
EXPECT_EQ(primary_display.id(),
- gfx::Screen::GetScreen()
+ display::Screen::GetScreen()
->GetDisplayNearestPoint(gfx::Point(-100, 0))
.id());
EXPECT_EQ(primary_display.id(),
- gfx::Screen::GetScreen()
+ display::Screen::GetScreen()
->GetDisplayNearestPoint(gfx::Point(0, -100))
.id());
EXPECT_EQ(primary_display.id(),
- gfx::Screen::GetScreen()
+ display::Screen::GetScreen()
->GetDisplayNearestPoint(gfx::Point(100, 100))
.id());
EXPECT_EQ(primary_display.id(),
- gfx::Screen::GetScreen()
+ display::Screen::GetScreen()
->GetDisplayNearestPoint(gfx::Point(224, 25))
.id());
EXPECT_EQ(secondary_display.id(),
- gfx::Screen::GetScreen()
+ display::Screen::GetScreen()
->GetDisplayNearestPoint(gfx::Point(226, 25))
.id());
EXPECT_EQ(secondary_display.id(),
- gfx::Screen::GetScreen()
+ display::Screen::GetScreen()
->GetDisplayNearestPoint(gfx::Point(600, 100))
.id());
EXPECT_EQ(primary_display.id(),
- gfx::Screen::GetScreen()
+ display::Screen::GetScreen()
->GetDisplayNearestPoint(gfx::Point(174, 225))
.id());
EXPECT_EQ(secondary_display.id(),
- gfx::Screen::GetScreen()
+ display::Screen::GetScreen()
->GetDisplayNearestPoint(gfx::Point(176, 225))
.id());
EXPECT_EQ(secondary_display.id(),
- gfx::Screen::GetScreen()
+ display::Screen::GetScreen()
->GetDisplayNearestPoint(gfx::Point(300, 400))
.id());
}
@@ -783,8 +786,9 @@ TEST_F(WindowTreeHostManagerTest, SwapPrimaryById) {
DisplayManager* display_manager = Shell::GetInstance()->display_manager();
UpdateDisplay("200x200,300x300");
- gfx::Display primary_display = gfx::Screen::GetScreen()->GetPrimaryDisplay();
- gfx::Display secondary_display = ScreenUtil::GetSecondaryDisplay();
+ display::Display primary_display =
+ display::Screen::GetScreen()->GetPrimaryDisplay();
+ display::Display secondary_display = ScreenUtil::GetSecondaryDisplay();
display_manager->SetLayoutForCurrentDisplays(
test::CreateDisplayLayout(display::DisplayPlacement::RIGHT, 50));
@@ -801,11 +805,12 @@ TEST_F(WindowTreeHostManagerTest, SwapPrimaryById) {
EXPECT_FALSE(secondary_root->Contains(shelf_window));
EXPECT_NE(primary_root, secondary_root);
EXPECT_EQ(primary_display.id(),
- gfx::Screen::GetScreen()
+ display::Screen::GetScreen()
->GetDisplayNearestPoint(gfx::Point(-100, -100))
.id());
- EXPECT_EQ(primary_display.id(),
- gfx::Screen::GetScreen()->GetDisplayNearestWindow(nullptr).id());
+ EXPECT_EQ(
+ primary_display.id(),
+ display::Screen::GetScreen()->GetDisplayNearestWindow(nullptr).id());
EXPECT_EQ("0,0 200x200", primary_display.bounds().ToString());
EXPECT_EQ("0,0 200x153", primary_display.work_area().ToString());
@@ -819,7 +824,7 @@ TEST_F(WindowTreeHostManagerTest, SwapPrimaryById) {
TestObserver observer;
window_tree_host_manager->SetPrimaryDisplayId(secondary_display.id());
EXPECT_EQ(secondary_display.id(),
- gfx::Screen::GetScreen()->GetPrimaryDisplay().id());
+ display::Screen::GetScreen()->GetPrimaryDisplay().id());
EXPECT_EQ(primary_display.id(), ScreenUtil::GetSecondaryDisplay().id());
EXPECT_LT(0, observer.CountAndReset());
@@ -836,8 +841,9 @@ TEST_F(WindowTreeHostManagerTest, SwapPrimaryById) {
EXPECT_EQ("id=2200000000, parent=2200000001, left, -50",
inverted_layout.placement_list[0].ToString());
// Test if the bounds are correctly swapped.
- gfx::Display swapped_primary = gfx::Screen::GetScreen()->GetPrimaryDisplay();
- gfx::Display swapped_secondary = ScreenUtil::GetSecondaryDisplay();
+ display::Display swapped_primary =
+ display::Screen::GetScreen()->GetPrimaryDisplay();
+ display::Display swapped_secondary = ScreenUtil::GetSecondaryDisplay();
EXPECT_EQ("0,0 300x300", swapped_primary.bounds().ToString());
EXPECT_EQ("0,0 300x253", swapped_primary.work_area().ToString());
EXPECT_EQ("-200,-50 200x200", swapped_secondary.bounds().ToString());
@@ -854,15 +860,16 @@ TEST_F(WindowTreeHostManagerTest, SwapPrimaryById) {
// Deleting 2nd display should move the primary to original primary display.
UpdateDisplay("200x200");
RunAllPendingInMessageLoop(); // RootWindow is deleted in a posted task.
- EXPECT_EQ(1, gfx::Screen::GetScreen()->GetNumDisplays());
+ EXPECT_EQ(1, display::Screen::GetScreen()->GetNumDisplays());
EXPECT_EQ(primary_display.id(),
- gfx::Screen::GetScreen()->GetPrimaryDisplay().id());
+ display::Screen::GetScreen()->GetPrimaryDisplay().id());
EXPECT_EQ(primary_display.id(),
- gfx::Screen::GetScreen()
+ display::Screen::GetScreen()
->GetDisplayNearestPoint(gfx::Point(-100, -100))
.id());
- EXPECT_EQ(primary_display.id(),
- gfx::Screen::GetScreen()->GetDisplayNearestWindow(nullptr).id());
+ EXPECT_EQ(
+ primary_display.id(),
+ display::Screen::GetScreen()->GetDisplayNearestWindow(nullptr).id());
EXPECT_TRUE(tracker.Contains(primary_root));
EXPECT_FALSE(tracker.Contains(secondary_root));
EXPECT_TRUE(primary_root->Contains(shelf_window));
@@ -877,9 +884,9 @@ TEST_F(WindowTreeHostManagerTest, SwapPrimaryById) {
display_manager->OnNativeDisplaysChanged(display_info_list);
- EXPECT_EQ(2, gfx::Screen::GetScreen()->GetNumDisplays());
+ EXPECT_EQ(2, display::Screen::GetScreen()->GetNumDisplays());
EXPECT_EQ(secondary_display.id(),
- gfx::Screen::GetScreen()->GetPrimaryDisplay().id());
+ display::Screen::GetScreen()->GetPrimaryDisplay().id());
EXPECT_EQ(primary_display.id(), ScreenUtil::GetSecondaryDisplay().id());
EXPECT_EQ(primary_root, window_tree_host_manager->GetRootWindowForDisplayId(
secondary_display.id()));
@@ -901,9 +908,9 @@ TEST_F(WindowTreeHostManagerTest, SwapPrimaryById) {
display_info_list2.push_back(primary_display_info);
display_info_list2.push_back(third_display_info);
display_manager->OnNativeDisplaysChanged(display_info_list2);
- EXPECT_EQ(2, gfx::Screen::GetScreen()->GetNumDisplays());
+ EXPECT_EQ(2, display::Screen::GetScreen()->GetNumDisplays());
EXPECT_EQ(primary_display.id(),
- gfx::Screen::GetScreen()->GetPrimaryDisplay().id());
+ display::Screen::GetScreen()->GetPrimaryDisplay().id());
EXPECT_EQ(third_display_info.id(), ScreenUtil::GetSecondaryDisplay().id());
EXPECT_EQ(primary_root, window_tree_host_manager->GetRootWindowForDisplayId(
primary_display.id()));
@@ -915,12 +922,12 @@ TEST_F(WindowTreeHostManagerTest, SwapPrimaryById) {
TEST_F(WindowTreeHostManagerTest, NoSwapPrimaryWithThreeDisplays) {
if (!SupportsMultipleDisplays())
return;
- int64_t primary = gfx::Screen::GetScreen()->GetPrimaryDisplay().id();
+ int64_t primary = display::Screen::GetScreen()->GetPrimaryDisplay().id();
UpdateDisplay("500x400,400x300,300x200");
- EXPECT_EQ(primary, gfx::Screen::GetScreen()->GetPrimaryDisplay().id());
+ EXPECT_EQ(primary, display::Screen::GetScreen()->GetPrimaryDisplay().id());
Shell::GetInstance()->window_tree_host_manager()->SetPrimaryDisplayId(
ScreenUtil::GetSecondaryDisplay().id());
- EXPECT_EQ(primary, gfx::Screen::GetScreen()->GetPrimaryDisplay().id());
+ EXPECT_EQ(primary, display::Screen::GetScreen()->GetPrimaryDisplay().id());
}
TEST_F(WindowTreeHostManagerTest, OverscanInsets) {
@@ -933,7 +940,7 @@ TEST_F(WindowTreeHostManagerTest, OverscanInsets) {
Shell::GetInstance()->AddPreTargetHandler(&event_handler);
UpdateDisplay("120x200,300x400*2");
- gfx::Display display1 = gfx::Screen::GetScreen()->GetPrimaryDisplay();
+ display::Display display1 = display::Screen::GetScreen()->GetPrimaryDisplay();
aura::Window::Windows root_windows = Shell::GetAllRootWindows();
window_tree_host_manager->SetOverscanInsets(display1.id(),
@@ -982,7 +989,7 @@ TEST_F(WindowTreeHostManagerTest, Rotate) {
Shell::GetInstance()->AddPreTargetHandler(&event_handler);
UpdateDisplay("120x200,300x400*2");
- gfx::Display display1 = gfx::Screen::GetScreen()->GetPrimaryDisplay();
+ display::Display display1 = display::Screen::GetScreen()->GetPrimaryDisplay();
int64_t display2_id = ScreenUtil::GetSecondaryDisplay().id();
aura::Window::Windows root_windows = Shell::GetAllRootWindows();
ui::test::EventGenerator generator1(root_windows[0]);
@@ -994,20 +1001,23 @@ TEST_F(WindowTreeHostManagerTest, Rotate) {
ScreenUtil::GetSecondaryDisplay().bounds().ToString());
generator1.MoveMouseToInHost(50, 40);
EXPECT_EQ("50,40", event_handler.GetLocationAndReset());
- EXPECT_EQ(gfx::Display::ROTATE_0, GetActiveDisplayRotation(display1.id()));
- EXPECT_EQ(gfx::Display::ROTATE_0, GetActiveDisplayRotation(display2_id));
+ EXPECT_EQ(display::Display::ROTATE_0,
+ GetActiveDisplayRotation(display1.id()));
+ EXPECT_EQ(display::Display::ROTATE_0, GetActiveDisplayRotation(display2_id));
EXPECT_EQ(0, observer.GetRotationChangedCountAndReset());
- display_manager->SetDisplayRotation(display1.id(), gfx::Display::ROTATE_90,
- gfx::Display::ROTATION_SOURCE_ACTIVE);
+ display_manager->SetDisplayRotation(display1.id(),
+ display::Display::ROTATE_90,
+ display::Display::ROTATION_SOURCE_ACTIVE);
EXPECT_EQ("200x120", root_windows[0]->bounds().size().ToString());
EXPECT_EQ("150x200", root_windows[1]->bounds().size().ToString());
EXPECT_EQ("200,0 150x200",
ScreenUtil::GetSecondaryDisplay().bounds().ToString());
generator1.MoveMouseToInHost(50, 40);
EXPECT_EQ("40,69", event_handler.GetLocationAndReset());
- EXPECT_EQ(gfx::Display::ROTATE_90, GetActiveDisplayRotation(display1.id()));
- EXPECT_EQ(gfx::Display::ROTATE_0, GetActiveDisplayRotation(display2_id));
+ EXPECT_EQ(display::Display::ROTATE_90,
+ GetActiveDisplayRotation(display1.id()));
+ EXPECT_EQ(display::Display::ROTATE_0, GetActiveDisplayRotation(display2_id));
EXPECT_EQ(1, observer.GetRotationChangedCountAndReset());
display_manager->SetLayoutForCurrentDisplays(
@@ -1015,30 +1025,35 @@ TEST_F(WindowTreeHostManagerTest, Rotate) {
EXPECT_EQ("50,120 150x200",
ScreenUtil::GetSecondaryDisplay().bounds().ToString());
- display_manager->SetDisplayRotation(display2_id, gfx::Display::ROTATE_270,
- gfx::Display::ROTATION_SOURCE_ACTIVE);
+ display_manager->SetDisplayRotation(display2_id, display::Display::ROTATE_270,
+ display::Display::ROTATION_SOURCE_ACTIVE);
EXPECT_EQ("200x120", root_windows[0]->bounds().size().ToString());
EXPECT_EQ("200x150", root_windows[1]->bounds().size().ToString());
EXPECT_EQ("50,120 200x150",
ScreenUtil::GetSecondaryDisplay().bounds().ToString());
- EXPECT_EQ(gfx::Display::ROTATE_90, GetActiveDisplayRotation(display1.id()));
- EXPECT_EQ(gfx::Display::ROTATE_270, GetActiveDisplayRotation(display2_id));
+ EXPECT_EQ(display::Display::ROTATE_90,
+ GetActiveDisplayRotation(display1.id()));
+ EXPECT_EQ(display::Display::ROTATE_270,
+ GetActiveDisplayRotation(display2_id));
EXPECT_EQ(1, observer.GetRotationChangedCountAndReset());
#if !defined(OS_WIN)
ui::test::EventGenerator generator2(root_windows[1]);
generator2.MoveMouseToInHost(50, 40);
EXPECT_EQ("179,25", event_handler.GetLocationAndReset());
- display_manager->SetDisplayRotation(display1.id(), gfx::Display::ROTATE_180,
- gfx::Display::ROTATION_SOURCE_ACTIVE);
+ display_manager->SetDisplayRotation(display1.id(),
+ display::Display::ROTATE_180,
+ display::Display::ROTATION_SOURCE_ACTIVE);
EXPECT_EQ("120x200", root_windows[0]->bounds().size().ToString());
EXPECT_EQ("200x150", root_windows[1]->bounds().size().ToString());
// Dislay must share at least 100, so the x's offset becomes 20.
EXPECT_EQ("20,200 200x150",
ScreenUtil::GetSecondaryDisplay().bounds().ToString());
- EXPECT_EQ(gfx::Display::ROTATE_180, GetActiveDisplayRotation(display1.id()));
- EXPECT_EQ(gfx::Display::ROTATE_270, GetActiveDisplayRotation(display2_id));
+ EXPECT_EQ(display::Display::ROTATE_180,
+ GetActiveDisplayRotation(display1.id()));
+ EXPECT_EQ(display::Display::ROTATE_270,
+ GetActiveDisplayRotation(display2_id));
EXPECT_EQ(1, observer.GetRotationChangedCountAndReset());
generator1.MoveMouseToInHost(50, 40);
@@ -1057,10 +1072,10 @@ TEST_F(WindowTreeHostManagerTest, ScaleRootWindow) {
UpdateDisplay("600x400*2@1.5,500x300");
- gfx::Display display1 = gfx::Screen::GetScreen()->GetPrimaryDisplay();
+ display::Display display1 = display::Screen::GetScreen()->GetPrimaryDisplay();
test::ScopedSetInternalDisplayId set_internal(display1.id());
- gfx::Display display2 = ScreenUtil::GetSecondaryDisplay();
+ display::Display display2 = ScreenUtil::GetSecondaryDisplay();
aura::Window::Windows root_windows = Shell::GetAllRootWindows();
EXPECT_EQ("0,0 450x300", display1.bounds().ToString());
EXPECT_EQ("0,0 450x300", root_windows[0]->bounds().ToString());
@@ -1073,7 +1088,7 @@ TEST_F(WindowTreeHostManagerTest, ScaleRootWindow) {
EXPECT_EQ("449,150", event_handler.GetLocationAndReset());
SetDisplayUIScale(display1.id(), 1.25f);
- display1 = gfx::Screen::GetScreen()->GetPrimaryDisplay();
+ display1 = display::Screen::GetScreen()->GetPrimaryDisplay();
display2 = ScreenUtil::GetSecondaryDisplay();
EXPECT_EQ("0,0 375x250", display1.bounds().ToString());
EXPECT_EQ("0,0 375x250", root_windows[0]->bounds().ToString());
@@ -1092,7 +1107,7 @@ TEST_F(WindowTreeHostManagerTest, TouchScale) {
Shell::GetInstance()->AddPreTargetHandler(&event_handler);
UpdateDisplay("200x200*2");
- gfx::Display display = gfx::Screen::GetScreen()->GetPrimaryDisplay();
+ display::Display display = display::Screen::GetScreen()->GetPrimaryDisplay();
aura::Window::Windows root_windows = Shell::GetAllRootWindows();
aura::Window* root_window = root_windows[0];
ui::test::EventGenerator generator(root_window);
@@ -1125,7 +1140,7 @@ TEST_F(WindowTreeHostManagerTest, ConvertHostToRootCoords) {
UpdateDisplay("600x400*2/r@1.5");
- gfx::Display display1 = gfx::Screen::GetScreen()->GetPrimaryDisplay();
+ display::Display display1 = display::Screen::GetScreen()->GetPrimaryDisplay();
aura::Window::Windows root_windows = Shell::GetAllRootWindows();
EXPECT_EQ("0,0 300x450", display1.bounds().ToString());
EXPECT_EQ("0,0 300x450", root_windows[0]->bounds().ToString());
@@ -1142,7 +1157,7 @@ TEST_F(WindowTreeHostManagerTest, ConvertHostToRootCoords) {
EXPECT_EQ("299,449", event_handler.GetLocationAndReset());
UpdateDisplay("600x400*2/u@1.5");
- display1 = gfx::Screen::GetScreen()->GetPrimaryDisplay();
+ display1 = display::Screen::GetScreen()->GetPrimaryDisplay();
root_windows = Shell::GetAllRootWindows();
EXPECT_EQ("0,0 450x300", display1.bounds().ToString());
EXPECT_EQ("0,0 450x300", root_windows[0]->bounds().ToString());
@@ -1158,7 +1173,7 @@ TEST_F(WindowTreeHostManagerTest, ConvertHostToRootCoords) {
EXPECT_EQ("449,0", event_handler.GetLocationAndReset());
UpdateDisplay("600x400*2/l@1.5");
- display1 = gfx::Screen::GetScreen()->GetPrimaryDisplay();
+ display1 = display::Screen::GetScreen()->GetPrimaryDisplay();
root_windows = Shell::GetAllRootWindows();
EXPECT_EQ("0,0 300x450", display1.bounds().ToString());
EXPECT_EQ("0,0 300x450", root_windows[0]->bounds().ToString());
@@ -1187,9 +1202,9 @@ TEST_F(WindowTreeHostManagerTest, DockToSingle) {
const int64_t internal_id = 1;
const DisplayInfo internal_display_info =
- CreateDisplayInfo(internal_id, 0, gfx::Display::ROTATE_0);
+ CreateDisplayInfo(internal_id, 0, display::Display::ROTATE_0);
const DisplayInfo external_display_info =
- CreateDisplayInfo(2, 1, gfx::Display::ROTATE_90);
+ CreateDisplayInfo(2, 1, display::Display::ROTATE_90);
std::vector<DisplayInfo> display_info_list;
// Extended
@@ -1230,9 +1245,9 @@ TEST_F(WindowTreeHostManagerTest, ReplaceSwappedPrimary) {
DisplayManager* display_manager = Shell::GetInstance()->display_manager();
const DisplayInfo first_display_info =
- CreateDisplayInfo(10, 0, gfx::Display::ROTATE_0);
+ CreateDisplayInfo(10, 0, display::Display::ROTATE_0);
const DisplayInfo second_display_info =
- CreateDisplayInfo(11, 1, gfx::Display::ROTATE_0);
+ CreateDisplayInfo(11, 1, display::Display::ROTATE_0);
std::vector<DisplayInfo> display_info_list;
// Extended
@@ -1242,18 +1257,18 @@ TEST_F(WindowTreeHostManagerTest, ReplaceSwappedPrimary) {
test::SwapPrimaryDisplay();
- EXPECT_EQ(11, gfx::Screen::GetScreen()->GetPrimaryDisplay().id());
+ EXPECT_EQ(11, display::Screen::GetScreen()->GetPrimaryDisplay().id());
display_info_list.clear();
const DisplayInfo new_first_display_info =
- CreateDisplayInfo(20, 0, gfx::Display::ROTATE_0);
+ CreateDisplayInfo(20, 0, display::Display::ROTATE_0);
const DisplayInfo new_second_display_info =
- CreateDisplayInfo(21, 1, gfx::Display::ROTATE_0);
+ CreateDisplayInfo(21, 1, display::Display::ROTATE_0);
display_info_list.push_back(new_first_display_info);
display_info_list.push_back(new_second_display_info);
display_manager->OnNativeDisplaysChanged(display_info_list);
- EXPECT_EQ(20, gfx::Screen::GetScreen()->GetPrimaryDisplay().id());
+ EXPECT_EQ(20, display::Screen::GetScreen()->GetPrimaryDisplay().id());
}
namespace {
@@ -1293,10 +1308,10 @@ TEST_F(WindowTreeHostManagerTest, ReplacePrimary) {
DisplayManager* display_manager = Shell::GetInstance()->display_manager();
DisplayInfo first_display_info =
- CreateDisplayInfo(10, 0, gfx::Display::ROTATE_0);
+ CreateDisplayInfo(10, 0, display::Display::ROTATE_0);
first_display_info.SetBounds(gfx::Rect(0, 0, 400, 400));
const DisplayInfo second_display_info =
- CreateDisplayInfo(11, 500, gfx::Display::ROTATE_0);
+ CreateDisplayInfo(11, 500, display::Display::ROTATE_0);
std::vector<DisplayInfo> display_info_list;
// Extended
@@ -1311,7 +1326,7 @@ TEST_F(WindowTreeHostManagerTest, ReplacePrimary) {
display_info_list.clear();
const DisplayInfo new_first_display_info =
- CreateDisplayInfo(new_display_id, 0, gfx::Display::ROTATE_0);
+ CreateDisplayInfo(new_display_id, 0, display::Display::ROTATE_0);
display_info_list.push_back(new_first_display_info);
display_manager->OnNativeDisplaysChanged(display_info_list);
@@ -1420,13 +1435,13 @@ TEST_F(WindowTreeHostManagerTest,
EXPECT_EQ("20,50", env->last_mouse_location().ToString());
EXPECT_EQ(1.0f, test_api.GetCurrentCursor().device_scale_factor());
- EXPECT_EQ(gfx::Display::ROTATE_0, test_api.GetCurrentCursorRotation());
+ EXPECT_EQ(display::Display::ROTATE_0, test_api.GetCurrentCursorRotation());
test::SwapPrimaryDisplay();
EXPECT_EQ("20,50", env->last_mouse_location().ToString());
EXPECT_EQ(2.0f, test_api.GetCurrentCursor().device_scale_factor());
- EXPECT_EQ(gfx::Display::ROTATE_90, test_api.GetCurrentCursorRotation());
+ EXPECT_EQ(display::Display::ROTATE_90, test_api.GetCurrentCursorRotation());
}
// Test that the cursor moves to the other display and that its scale factor
@@ -1453,7 +1468,7 @@ TEST_F(WindowTreeHostManagerTest,
EXPECT_EQ("20,50", env->last_mouse_location().ToString());
EXPECT_EQ(1.0f, test_api.GetCurrentCursor().device_scale_factor());
- EXPECT_EQ(gfx::Display::ROTATE_0, test_api.GetCurrentCursorRotation());
+ EXPECT_EQ(display::Display::ROTATE_0, test_api.GetCurrentCursorRotation());
UpdateDisplay("300x300*2/r");
ASSERT_NE(primary_display_id,
@@ -1462,10 +1477,10 @@ TEST_F(WindowTreeHostManagerTest,
// Cursor should be centered on the remaining display.
EXPECT_EQ("75,75", env->last_mouse_location().ToString());
EXPECT_EQ(2.0f, test_api.GetCurrentCursor().device_scale_factor());
- EXPECT_EQ(gfx::Display::ROTATE_90, test_api.GetCurrentCursorRotation());
+ EXPECT_EQ(display::Display::ROTATE_90, test_api.GetCurrentCursorRotation());
}
-// GetRootWindowForDisplayId() for removed gfx::Display during
+// GetRootWindowForDisplayId() for removed display::Display during
// OnDisplayRemoved() should not cause crash. See http://crbug.com/415222
TEST_F(WindowTreeHostManagerTest,
GetRootWindowForDisplayIdDuringDisplayDisconnection) {
« no previous file with comments | « ash/display/window_tree_host_manager.cc ('k') | ash/drag_drop/drag_drop_tracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698