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

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

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

Powered by Google App Engine
This is Rietveld 408576698