OLD | NEW |
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 <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "ash/display/display_controller.h" | 10 #include "ash/display/display_controller.h" |
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
417 EXPECT_EQ(400, height); | 417 EXPECT_EQ(400, height); |
418 } | 418 } |
419 | 419 |
420 TEST_F(DisplayPreferencesTest, PreventStore) { | 420 TEST_F(DisplayPreferencesTest, PreventStore) { |
421 ResolutionNotificationController::SuppressTimerForTest(); | 421 ResolutionNotificationController::SuppressTimerForTest(); |
422 LoggedInAsUser(); | 422 LoggedInAsUser(); |
423 UpdateDisplay("400x300#500x400|400x300|300x200"); | 423 UpdateDisplay("400x300#500x400|400x300|300x200"); |
424 int64 id = ash::Shell::GetScreen()->GetPrimaryDisplay().id(); | 424 int64 id = ash::Shell::GetScreen()->GetPrimaryDisplay().id(); |
425 // Set display's resolution in single display. It creates the notification and | 425 // Set display's resolution in single display. It creates the notification and |
426 // display preferences should not stored meanwhile. | 426 // display preferences should not stored meanwhile. |
427 ash::Shell::GetInstance()->resolution_notification_controller()-> | 427 ash::Shell* shell = ash::Shell::GetInstance(); |
428 SetDisplayResolutionAndNotify( | 428 ash::DisplayMode old_mode; |
429 id, gfx::Size(400, 300), gfx::Size(500, 400), base::Closure()); | 429 ash::DisplayMode new_mode; |
| 430 old_mode.size = gfx::Size(400, 300); |
| 431 new_mode.size = gfx::Size(500, 400); |
| 432 if (shell->display_manager()->SetDisplayMode(id, new_mode)) { |
| 433 shell->resolution_notification_controller()->PrepareNotification( |
| 434 id, old_mode, new_mode, base::Closure()); |
| 435 } |
430 UpdateDisplay("500x400#500x400|400x300|300x200"); | 436 UpdateDisplay("500x400#500x400|400x300|300x200"); |
431 | 437 |
432 const base::DictionaryValue* properties = | 438 const base::DictionaryValue* properties = |
433 local_state()->GetDictionary(prefs::kDisplayProperties); | 439 local_state()->GetDictionary(prefs::kDisplayProperties); |
434 const base::DictionaryValue* property = NULL; | 440 const base::DictionaryValue* property = NULL; |
435 EXPECT_TRUE(properties->GetDictionary(base::Int64ToString(id), &property)); | 441 EXPECT_TRUE(properties->GetDictionary(base::Int64ToString(id), &property)); |
436 int width = 0, height = 0; | 442 int width = 0, height = 0; |
437 EXPECT_FALSE(property->GetInteger("width", &width)); | 443 EXPECT_FALSE(property->GetInteger("width", &width)); |
438 EXPECT_FALSE(property->GetInteger("height", &height)); | 444 EXPECT_FALSE(property->GetInteger("height", &height)); |
439 | 445 |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
657 local_state()->GetDictionary(prefs::kDisplayProperties); | 663 local_state()->GetDictionary(prefs::kDisplayProperties); |
658 const base::DictionaryValue* property = NULL; | 664 const base::DictionaryValue* property = NULL; |
659 EXPECT_TRUE(properties->GetDictionary( | 665 EXPECT_TRUE(properties->GetDictionary( |
660 base::Int64ToString(gfx::Display::InternalDisplayId()), &property)); | 666 base::Int64ToString(gfx::Display::InternalDisplayId()), &property)); |
661 int rotation = -1; | 667 int rotation = -1; |
662 EXPECT_TRUE(property->GetInteger("rotation", &rotation)); | 668 EXPECT_TRUE(property->GetInteger("rotation", &rotation)); |
663 EXPECT_EQ(gfx::Display::ROTATE_0, rotation); | 669 EXPECT_EQ(gfx::Display::ROTATE_0, rotation); |
664 } | 670 } |
665 | 671 |
666 } // namespace chromeos | 672 } // namespace chromeos |
OLD | NEW |