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

Unified Diff: ash/wm/lock_state_controller_unittest.cc

Issue 187073002: Refactoring display configuration state to allow generic state objects (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 6 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/touch/touch_observer_hud.cc ('k') | ash/wm/power_button_controller.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/wm/lock_state_controller_unittest.cc
diff --git a/ash/wm/lock_state_controller_unittest.cc b/ash/wm/lock_state_controller_unittest.cc
index bfbfeef6e2bb4652fc442f8516c638b5d745a159..fd49ef1b5e8ed2a569327ac4f693d3a9951daf8f 100644
--- a/ash/wm/lock_state_controller_unittest.cc
+++ b/ash/wm/lock_state_controller_unittest.cc
@@ -27,6 +27,7 @@
#if defined(OS_CHROMEOS) && defined(USE_X11)
#include "ui/display/chromeos/output_configurator.h"
+#include "ui/display/chromeos/test/test_display_snapshot.h"
#include "ui/display/display_constants.h"
#endif
@@ -998,20 +999,32 @@ TEST_F(LockStateControllerTest, IgnorePowerButtonIfScreenIsOff) {
#if defined(OS_CHROMEOS) && defined(USE_X11)
TEST_F(LockStateControllerTest, HonorPowerButtonInDockedMode) {
+ ScopedVector<const ui::DisplayMode> modes;
+ modes.push_back(new ui::DisplayMode(gfx::Size(1, 1), false, 60.0f));
+
// Create two outputs, the first internal and the second external.
- std::vector<ui::OutputConfigurator::OutputSnapshot> outputs;
- ui::OutputConfigurator::OutputSnapshot internal_output;
- internal_output.type = ui::OUTPUT_TYPE_INTERNAL;
+ ui::OutputConfigurator::DisplayStateList outputs;
+ ui::OutputConfigurator::DisplayState internal_output;
+ ui::TestDisplaySnapshot internal_display;
+ internal_display.set_type(ui::OUTPUT_TYPE_INTERNAL);
+ internal_display.set_modes(modes.get());
+ internal_output.display = &internal_display;
outputs.push_back(internal_output);
- ui::OutputConfigurator::OutputSnapshot external_output;
- external_output.type = ui::OUTPUT_TYPE_HDMI;
+
+ ui::OutputConfigurator::DisplayState external_output;
+ ui::TestDisplaySnapshot external_display;
+ external_display.set_type(ui::OUTPUT_TYPE_HDMI);
+ external_display.set_modes(modes.get());
+ external_output.display = &external_display;
outputs.push_back(external_output);
// When all of the displays are turned off (e.g. due to user inactivity), the
// power button should be ignored.
controller_->OnScreenBrightnessChanged(0.0);
- outputs[0].current_mode = 0;
- outputs[1].current_mode = 0;
+ static_cast<ui::TestDisplaySnapshot*>(outputs[0].display)
+ ->set_current_mode(NULL);
+ static_cast<ui::TestDisplaySnapshot*>(outputs[1].display)
+ ->set_current_mode(NULL);
controller_->OnDisplayModeChanged(outputs);
PressPowerButton();
EXPECT_FALSE(test_api_->is_animating_lock());
@@ -1020,7 +1033,8 @@ TEST_F(LockStateControllerTest, HonorPowerButtonInDockedMode) {
// When the screen brightness is 0% but the external display is still turned
// on (indicating either docked mode or the user having manually decreased the
// brightness to 0%), the power button should still be handled.
- outputs[1].current_mode = 1;
+ static_cast<ui::TestDisplaySnapshot*>(outputs[1].display)
+ ->set_current_mode(modes[0]);
controller_->OnDisplayModeChanged(outputs);
PressPowerButton();
EXPECT_TRUE(test_api_->is_animating_lock());
« no previous file with comments | « ash/touch/touch_observer_hud.cc ('k') | ash/wm/power_button_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698