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

Side by Side Diff: ash/display/multi_display_manager_unittest.cc

Issue 10696002: ASH: Use virtual screen coordinates in Display::bounds() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync Created 8 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
« no previous file with comments | « ash/display/multi_display_manager.cc ('k') | ash/extended_desktop_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/display/multi_display_manager.h" 5 #include "ash/display/multi_display_manager.h"
6 6
7 #include "ash/shell.h" 7 #include "ash/shell.h"
8 #include "ash/test/ash_test_base.h" 8 #include "ash/test/ash_test_base.h"
9 #include "base/format_macros.h" 9 #include "base/format_macros.h"
10 #include "base/stringprintf.h" 10 #include "base/stringprintf.h"
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 91
92 TEST_F(MultiDisplayManagerTest, NativeDisplayTest) { 92 TEST_F(MultiDisplayManagerTest, NativeDisplayTest) {
93 aura::DisplayManager::set_use_fullscreen_host_window(true); 93 aura::DisplayManager::set_use_fullscreen_host_window(true);
94 94
95 EXPECT_EQ(1U, display_manager()->GetNumDisplays()); 95 EXPECT_EQ(1U, display_manager()->GetNumDisplays());
96 96
97 // Update primary and add seconary. 97 // Update primary and add seconary.
98 UpdateDisplay("0+0-500x500,0+501-400x400"); 98 UpdateDisplay("0+0-500x500,0+501-400x400");
99 EXPECT_EQ(2U, display_manager()->GetNumDisplays()); 99 EXPECT_EQ(2U, display_manager()->GetNumDisplays());
100 EXPECT_EQ("1 1 0", GetCountSummary()); 100 EXPECT_EQ("1 1 0", GetCountSummary());
101 EXPECT_EQ(display_manager()->GetDisplayAt(0).id(), changed()[0].id()); 101 EXPECT_EQ(display_manager()->GetDisplayAt(0)->id(), changed()[0].id());
102 EXPECT_EQ(display_manager()->GetDisplayAt(1).id(), added()[0].id()); 102 EXPECT_EQ(display_manager()->GetDisplayAt(1)->id(), added()[0].id());
103 EXPECT_EQ("0,0 500x500", changed()[0].bounds().ToString()); 103 EXPECT_EQ("0,0 500x500", changed()[0].bounds().ToString());
104 EXPECT_EQ("0,0 400x400", added()[0].bounds().ToString()); 104 EXPECT_EQ("0,0 400x400", added()[0].bounds().ToString());
105 EXPECT_EQ("0,501 400x400", added()[0].bounds_in_pixel().ToString()); 105 EXPECT_EQ("0,501 400x400", added()[0].bounds_in_pixel().ToString());
106 reset(); 106 reset();
107 107
108 // Delete secondary. 108 // Delete secondary.
109 UpdateDisplay("0+0-500x500"); 109 UpdateDisplay("0+0-500x500");
110 EXPECT_EQ("0 0 1", GetCountSummary()); 110 EXPECT_EQ("0 0 1", GetCountSummary());
111 reset(); 111 reset();
112 112
113 // Change primary. 113 // Change primary.
114 UpdateDisplay("0+0-1000x600"); 114 UpdateDisplay("0+0-1000x600");
115 EXPECT_EQ("1 0 0", GetCountSummary()); 115 EXPECT_EQ("1 0 0", GetCountSummary());
116 EXPECT_EQ(display_manager()->GetDisplayAt(0).id(), changed()[0].id()); 116 EXPECT_EQ(display_manager()->GetDisplayAt(0)->id(), changed()[0].id());
117 EXPECT_EQ("0,0 1000x600", changed()[0].bounds().ToString()); 117 EXPECT_EQ("0,0 1000x600", changed()[0].bounds().ToString());
118 reset(); 118 reset();
119 119
120 // Add secondary. 120 // Add secondary.
121 UpdateDisplay("0+0-1000x600,1001+0-600x400"); 121 UpdateDisplay("0+0-1000x600,1001+0-600x400");
122 EXPECT_EQ(2U, display_manager()->GetNumDisplays()); 122 EXPECT_EQ(2U, display_manager()->GetNumDisplays());
123 EXPECT_EQ("0 1 0", GetCountSummary()); 123 EXPECT_EQ("0 1 0", GetCountSummary());
124 EXPECT_EQ(display_manager()->GetDisplayAt(1).id(), added()[0].id()); 124 EXPECT_EQ(display_manager()->GetDisplayAt(1)->id(), added()[0].id());
125 EXPECT_EQ("0,0 600x400", added()[0].bounds().ToString()); 125 EXPECT_EQ("0,0 600x400", added()[0].bounds().ToString());
126 EXPECT_EQ("1001,0 600x400", added()[0].bounds_in_pixel().ToString()); 126 EXPECT_EQ("1001,0 600x400", added()[0].bounds_in_pixel().ToString());
127 reset(); 127 reset();
128 128
129 // Secondary removed, primary changed. 129 // Secondary removed, primary changed.
130 UpdateDisplay("0+0-800x300"); 130 UpdateDisplay("0+0-800x300");
131 EXPECT_EQ(1U, display_manager()->GetNumDisplays()); 131 EXPECT_EQ(1U, display_manager()->GetNumDisplays());
132 EXPECT_EQ("1 0 1", GetCountSummary()); 132 EXPECT_EQ("1 0 1", GetCountSummary());
133 EXPECT_EQ(display_manager()->GetDisplayAt(0).id(), changed()[0].id()); 133 EXPECT_EQ(display_manager()->GetDisplayAt(0)->id(), changed()[0].id());
134 EXPECT_EQ("0,0 800x300", changed()[0].bounds().ToString()); 134 EXPECT_EQ("0,0 800x300", changed()[0].bounds().ToString());
135 reset(); 135 reset();
136 136
137 // # of display can go to zero when screen is off. 137 // # of display can go to zero when screen is off.
138 const vector<gfx::Display> empty; 138 const vector<gfx::Display> empty;
139 display_manager()->OnNativeDisplaysChanged(empty); 139 display_manager()->OnNativeDisplaysChanged(empty);
140 EXPECT_EQ(1U, display_manager()->GetNumDisplays()); 140 EXPECT_EQ(1U, display_manager()->GetNumDisplays());
141 EXPECT_EQ("0 0 0", GetCountSummary()); 141 EXPECT_EQ("0 0 0", GetCountSummary());
142 EXPECT_FALSE(root_window_destroyed()); 142 EXPECT_FALSE(root_window_destroyed());
143 // Display configuration stays the same 143 // Display configuration stays the same
144 EXPECT_EQ("0,0 800x300", 144 EXPECT_EQ("0,0 800x300",
145 display_manager()->GetDisplayAt(0).bounds().ToString()); 145 display_manager()->GetDisplayAt(0)->bounds().ToString());
146 reset(); 146 reset();
147 147
148 // Connect to display again 148 // Connect to display again
149 UpdateDisplay("100+100-500x400"); 149 UpdateDisplay("100+100-500x400");
150 EXPECT_EQ(1U, display_manager()->GetNumDisplays()); 150 EXPECT_EQ(1U, display_manager()->GetNumDisplays());
151 EXPECT_EQ("1 0 0", GetCountSummary()); 151 EXPECT_EQ("1 0 0", GetCountSummary());
152 EXPECT_FALSE(root_window_destroyed()); 152 EXPECT_FALSE(root_window_destroyed());
153 EXPECT_EQ("0,0 500x400", changed()[0].bounds().ToString()); 153 EXPECT_EQ("0,0 500x400", changed()[0].bounds().ToString());
154 EXPECT_EQ("100,100 500x400", changed()[0].bounds_in_pixel().ToString()); 154 EXPECT_EQ("100,100 500x400", changed()[0].bounds_in_pixel().ToString());
155 reset(); 155 reset();
156 156
157 // Go back to zero and wake up with multiple displays. 157 // Go back to zero and wake up with multiple displays.
158 display_manager()->OnNativeDisplaysChanged(empty); 158 display_manager()->OnNativeDisplaysChanged(empty);
159 EXPECT_EQ(1U, display_manager()->GetNumDisplays()); 159 EXPECT_EQ(1U, display_manager()->GetNumDisplays());
160 EXPECT_FALSE(root_window_destroyed()); 160 EXPECT_FALSE(root_window_destroyed());
161 reset(); 161 reset();
162 162
163 // Add secondary. 163 // Add secondary.
164 UpdateDisplay("0+0-1000x600,1000+0-600x400"); 164 UpdateDisplay("0+0-1000x600,1000+0-600x400");
165 EXPECT_EQ(2U, display_manager()->GetNumDisplays()); 165 EXPECT_EQ(2U, display_manager()->GetNumDisplays());
166 EXPECT_EQ("0,0 1000x600", 166 EXPECT_EQ("0,0 1000x600",
167 display_manager()->GetDisplayAt(0).bounds().ToString()); 167 display_manager()->GetDisplayAt(0)->bounds().ToString());
168 EXPECT_EQ("0,0 600x400", 168 EXPECT_EQ("0,0 600x400",
169 display_manager()->GetDisplayAt(1).bounds().ToString()); 169 display_manager()->GetDisplayAt(1)->bounds().ToString());
170 EXPECT_EQ("1000,0 600x400", 170 EXPECT_EQ("1000,0 600x400",
171 display_manager()->GetDisplayAt(1).bounds_in_pixel().ToString()); 171 display_manager()->GetDisplayAt(1)->bounds_in_pixel().ToString());
172 reset(); 172 reset();
173 173
174 aura::DisplayManager::set_use_fullscreen_host_window(false); 174 aura::DisplayManager::set_use_fullscreen_host_window(false);
175 } 175 }
176 176
177 // Test in emulation mode (use_fullscreen_host_window=false) 177 // Test in emulation mode (use_fullscreen_host_window=false)
178 TEST_F(MultiDisplayManagerTest, EmulatorTest) { 178 TEST_F(MultiDisplayManagerTest, EmulatorTest) {
179 EXPECT_EQ(1U, display_manager()->GetNumDisplays()); 179 EXPECT_EQ(1U, display_manager()->GetNumDisplays());
180 180
181 internal::MultiDisplayManager::AddRemoveDisplay(); 181 internal::MultiDisplayManager::AddRemoveDisplay();
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 UpdateDisplay("0+0-1000x600*2"); 226 UpdateDisplay("0+0-1000x600*2");
227 EXPECT_EQ(2, 227 EXPECT_EQ(2,
228 Shell::GetPrimaryRootWindow()->compositor()->device_scale_factor()); 228 Shell::GetPrimaryRootWindow()->compositor()->device_scale_factor());
229 EXPECT_EQ("500x300", 229 EXPECT_EQ("500x300",
230 Shell::GetPrimaryRootWindow()->bounds().size().ToString()); 230 Shell::GetPrimaryRootWindow()->bounds().size().ToString());
231 aura::DisplayManager::set_use_fullscreen_host_window(false); 231 aura::DisplayManager::set_use_fullscreen_host_window(false);
232 } 232 }
233 233
234 } // namespace test 234 } // namespace test
235 } // namespace ash 235 } // namespace ash
OLDNEW
« no previous file with comments | « ash/display/multi_display_manager.cc ('k') | ash/extended_desktop_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698