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

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

Issue 2799963003: Fix errors in display resolution change notifications (Closed)
Patch Set: Fix compile errors on non-cros systems Created 3 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 unified diff | Download patch
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 <stdint.h> 7 #include <stdint.h>
8 8
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after
567 UpdateDisplay("400x300#500x400|400x300|300x200"); 567 UpdateDisplay("400x300#500x400|400x300|300x200");
568 int64_t id = display::Screen::GetScreen()->GetPrimaryDisplay().id(); 568 int64_t id = display::Screen::GetScreen()->GetPrimaryDisplay().id();
569 // Set display's resolution in single display. It creates the notification and 569 // Set display's resolution in single display. It creates the notification and
570 // display preferences should not stored meanwhile. 570 // display preferences should not stored meanwhile.
571 ash::Shell* shell = ash::Shell::Get(); 571 ash::Shell* shell = ash::Shell::Get();
572 572
573 scoped_refptr<display::ManagedDisplayMode> old_mode( 573 scoped_refptr<display::ManagedDisplayMode> old_mode(
574 new display::ManagedDisplayMode(gfx::Size(400, 300))); 574 new display::ManagedDisplayMode(gfx::Size(400, 300)));
575 scoped_refptr<display::ManagedDisplayMode> new_mode( 575 scoped_refptr<display::ManagedDisplayMode> new_mode(
576 new display::ManagedDisplayMode(gfx::Size(500, 400))); 576 new display::ManagedDisplayMode(gfx::Size(500, 400)));
577 if (shell->display_manager()->SetDisplayMode(id, new_mode)) { 577 EXPECT_TRUE(shell->resolution_notification_controller()
578 shell->resolution_notification_controller()->PrepareNotification( 578 ->PrepareNotificationAndSetDisplayMode(id, old_mode, new_mode,
579 id, old_mode, new_mode, base::Closure()); 579 base::Closure()));
580 }
581 UpdateDisplay("500x400#500x400|400x300|300x200"); 580 UpdateDisplay("500x400#500x400|400x300|300x200");
582 581
583 const base::DictionaryValue* properties = 582 const base::DictionaryValue* properties =
584 local_state()->GetDictionary(prefs::kDisplayProperties); 583 local_state()->GetDictionary(prefs::kDisplayProperties);
585 const base::DictionaryValue* property = nullptr; 584 const base::DictionaryValue* property = nullptr;
586 EXPECT_TRUE(properties->GetDictionary(base::Int64ToString(id), &property)); 585 EXPECT_TRUE(properties->GetDictionary(base::Int64ToString(id), &property));
587 int width = 0, height = 0; 586 int width = 0, height = 0;
588 EXPECT_FALSE(property->GetInteger("width", &width)); 587 EXPECT_FALSE(property->GetInteger("width", &width));
589 EXPECT_FALSE(property->GetInteger("height", &height)); 588 EXPECT_FALSE(property->GetInteger("height", &height));
590 589
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after
1151 1150
1152 EXPECT_EQ(gfx::Rect(0, 0, 200, 200), 1151 EXPECT_EQ(gfx::Rect(0, 0, 200, 200),
1153 display_manager()->GetDisplayForId(list[0]).bounds()); 1152 display_manager()->GetDisplayForId(list[0]).bounds());
1154 EXPECT_EQ(gfx::Rect(-200, 0, 200, 200), 1153 EXPECT_EQ(gfx::Rect(-200, 0, 200, 200),
1155 display_manager()->GetDisplayForId(list[1]).bounds()); 1154 display_manager()->GetDisplayForId(list[1]).bounds());
1156 EXPECT_EQ(gfx::Rect(-100, 200, 300, 300), 1155 EXPECT_EQ(gfx::Rect(-100, 200, 300, 300),
1157 display_manager()->GetDisplayForId(list[2]).bounds()); 1156 display_manager()->GetDisplayForId(list[2]).bounds());
1158 } 1157 }
1159 1158
1160 } // namespace chromeos 1159 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698