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

Side by Side Diff: chrome/browser/chromeos/display/display_preferences_unittest.cc

Issue 21297003: Add ability to set resolution on external display (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 4 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
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 "chrome/browser/chromeos/display/display_preferences.h" 5 #include "chrome/browser/chromeos/display/display_preferences.h"
6 6
7 #include "ash/display/display_controller.h" 7 #include "ash/display/display_controller.h"
8 #include "ash/display/display_layout_store.h" 8 #include "ash/display/display_layout_store.h"
9 #include "ash/display/display_manager.h" 9 #include "ash/display/display_manager.h"
10 #include "ash/screen_ash.h" 10 #include "ash/screen_ash.h"
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 EXPECT_EQ("top, 20", GetRegisteredDisplayLayoutStr(id1, id2)); 176 EXPECT_EQ("top, 20", GetRegisteredDisplayLayoutStr(id1, id2));
177 EXPECT_EQ("left, 30", GetRegisteredDisplayLayoutStr(id1, dummy_id)); 177 EXPECT_EQ("left, 30", GetRegisteredDisplayLayoutStr(id1, dummy_id));
178 } 178 }
179 179
180 TEST_F(DisplayPreferencesTest, BasicStores) { 180 TEST_F(DisplayPreferencesTest, BasicStores) {
181 ash::DisplayController* display_controller = 181 ash::DisplayController* display_controller =
182 ash::Shell::GetInstance()->display_controller(); 182 ash::Shell::GetInstance()->display_controller();
183 ash::internal::DisplayManager* display_manager = 183 ash::internal::DisplayManager* display_manager =
184 ash::Shell::GetInstance()->display_manager(); 184 ash::Shell::GetInstance()->display_manager();
185 185
186 UpdateDisplay("200x200*2,200x200"); 186 UpdateDisplay("300x200*2,400x300");
187 int64 id1 = gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().id(); 187 int64 id1 = gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().id();
188 gfx::Display::SetInternalDisplayId(id1); 188 gfx::Display::SetInternalDisplayId(id1);
189 int64 id2 = ash::ScreenAsh::GetSecondaryDisplay().id(); 189 int64 id2 = ash::ScreenAsh::GetSecondaryDisplay().id();
190 int64 dummy_id = id2 + 1; 190 int64 dummy_id = id2 + 1;
191 ASSERT_NE(id1, dummy_id); 191 ASSERT_NE(id1, dummy_id);
192 192
193 LoggedInAsUser(); 193 LoggedInAsUser();
194 ash::DisplayLayout layout(ash::DisplayLayout::TOP, 10); 194 ash::DisplayLayout layout(ash::DisplayLayout::TOP, 10);
195 SetCurrentDisplayLayout(layout); 195 SetCurrentDisplayLayout(layout);
196 StoreDisplayLayoutPrefForTest( 196 StoreDisplayLayoutPrefForTest(
(...skipping 27 matching lines...) Expand all
224 local_state()->GetDictionary(prefs::kDisplayProperties); 224 local_state()->GetDictionary(prefs::kDisplayProperties);
225 const base::DictionaryValue* property = NULL; 225 const base::DictionaryValue* property = NULL;
226 EXPECT_TRUE(properties->GetDictionary(base::Int64ToString(id1), &property)); 226 EXPECT_TRUE(properties->GetDictionary(base::Int64ToString(id1), &property));
227 int ui_scale = 0; 227 int ui_scale = 0;
228 int rotation = 0; 228 int rotation = 0;
229 EXPECT_TRUE(property->GetInteger("rotation", &rotation)); 229 EXPECT_TRUE(property->GetInteger("rotation", &rotation));
230 EXPECT_TRUE(property->GetInteger("ui-scale", &ui_scale)); 230 EXPECT_TRUE(property->GetInteger("ui-scale", &ui_scale));
231 EXPECT_EQ(1, rotation); 231 EXPECT_EQ(1, rotation);
232 EXPECT_EQ(1250, ui_scale); 232 EXPECT_EQ(1250, ui_scale);
233 233
234 int width = 0, height = 0;
235 EXPECT_FALSE(property->GetInteger("width", &width));
236 EXPECT_FALSE(property->GetInteger("height", &height));
237
234 int top = 0, left = 0, bottom = 0, right = 0; 238 int top = 0, left = 0, bottom = 0, right = 0;
235 EXPECT_TRUE(property->GetInteger("insets_top", &top)); 239 EXPECT_TRUE(property->GetInteger("insets_top", &top));
236 EXPECT_TRUE(property->GetInteger("insets_left", &left)); 240 EXPECT_TRUE(property->GetInteger("insets_left", &left));
237 EXPECT_TRUE(property->GetInteger("insets_bottom", &bottom)); 241 EXPECT_TRUE(property->GetInteger("insets_bottom", &bottom));
238 EXPECT_TRUE(property->GetInteger("insets_right", &right)); 242 EXPECT_TRUE(property->GetInteger("insets_right", &right));
239 EXPECT_EQ(10, top); 243 EXPECT_EQ(10, top);
240 EXPECT_EQ(11, left); 244 EXPECT_EQ(11, left);
241 EXPECT_EQ(12, bottom); 245 EXPECT_EQ(12, bottom);
242 EXPECT_EQ(13, right); 246 EXPECT_EQ(13, right);
243 247
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 StoreDisplayPowerStateForTest( 395 StoreDisplayPowerStateForTest(
392 chromeos::DISPLAY_POWER_INTERNAL_OFF_EXTERNAL_ON); 396 chromeos::DISPLAY_POWER_INTERNAL_OFF_EXTERNAL_ON);
393 LoadDisplayPreferences(false); 397 LoadDisplayPreferences(false);
394 EXPECT_EQ( 398 EXPECT_EQ(
395 chromeos::DISPLAY_POWER_INTERNAL_OFF_EXTERNAL_ON, 399 chromeos::DISPLAY_POWER_INTERNAL_OFF_EXTERNAL_ON,
396 ash::Shell::GetInstance()->output_configurator()->power_state()); 400 ash::Shell::GetInstance()->output_configurator()->power_state());
397 } 401 }
398 402
399 } // namespace 403 } // namespace
400 } // namespace chromeos 404 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698