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

Unified Diff: ash/wm/lock_state_controller_unittest.cc

Issue 2407153008: Delete TestDisplaySnapshot and update tests. (Closed)
Patch Set: Rebase and cleanup. Created 4 years, 2 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/display/projecting_observer_chromeos_unittest.cc ('k') | ui/display/BUILD.gn » ('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 e8f7b38017eb410f317d35be417ab5a1a11049a5..3f1501f6fe357b1769b170fb6958f270049408d9 100644
--- a/ash/wm/lock_state_controller_unittest.cc
+++ b/ash/wm/lock_state_controller_unittest.cc
@@ -24,7 +24,7 @@
#include "chromeos/dbus/dbus_thread_manager.h"
#include "chromeos/dbus/fake_session_manager_client.h"
#include "ui/display/chromeos/display_configurator.h"
-#include "ui/display/chromeos/test/test_display_snapshot.h"
+#include "ui/display/fake_display_snapshot.h"
#include "ui/display/types/display_constants.h"
#include "ui/events/test/event_generator.h"
#include "ui/gfx/geometry/size.h"
@@ -887,30 +887,30 @@ TEST_F(LockStateControllerTest, IgnorePowerButtonIfScreenIsOff) {
}
TEST_F(LockStateControllerTest, HonorPowerButtonInDockedMode) {
- std::vector<std::unique_ptr<const ui::DisplayMode>> modes;
- modes.push_back(
- base::MakeUnique<ui::DisplayMode>(gfx::Size(1, 1), false, 60.0f));
-
// Create two outputs, the first internal and the second external.
ui::DisplayConfigurator::DisplayStateList outputs;
- ui::TestDisplaySnapshot internal_display;
- internal_display.set_type(ui::DISPLAY_CONNECTION_TYPE_INTERNAL);
- internal_display.set_modes(std::move(modes));
- outputs.push_back(&internal_display);
-
- modes.clear();
- modes.push_back(
- base::MakeUnique<ui::DisplayMode>(gfx::Size(1, 1), false, 60.0f));
- ui::TestDisplaySnapshot external_display;
- external_display.set_type(ui::DISPLAY_CONNECTION_TYPE_HDMI);
- external_display.set_modes(std::move(modes));
- outputs.push_back(&external_display);
+
+ std::unique_ptr<ui::DisplaySnapshot> internal_display =
+ display::FakeDisplaySnapshot::Builder()
+ .SetId(123)
+ .SetNativeMode(gfx::Size(1, 1))
+ .SetType(ui::DISPLAY_CONNECTION_TYPE_INTERNAL)
+ .Build();
+ outputs.push_back(internal_display.get());
+
+ std::unique_ptr<ui::DisplaySnapshot> external_display =
+ display::FakeDisplaySnapshot::Builder()
+ .SetId(456)
+ .SetNativeMode(gfx::Size(1, 1))
+ .SetType(ui::DISPLAY_CONNECTION_TYPE_HDMI)
+ .Build();
+ outputs.push_back(external_display.get());
// When all of the displays are turned off (e.g. due to user inactivity), the
// power button should be ignored.
power_button_controller_->OnScreenBrightnessChanged(0.0);
- internal_display.set_current_mode(nullptr);
- external_display.set_current_mode(nullptr);
+ internal_display->set_current_mode(nullptr);
+ external_display->set_current_mode(nullptr);
power_button_controller_->OnDisplayModeChanged(outputs);
PressPowerButton();
EXPECT_FALSE(test_api_->is_animating_lock());
@@ -919,7 +919,7 @@ 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.
- external_display.set_current_mode(external_display.modes().back().get());
+ external_display->set_current_mode(external_display->modes().back().get());
power_button_controller_->OnDisplayModeChanged(outputs);
PressPowerButton();
EXPECT_TRUE(test_api_->is_animating_lock());
« no previous file with comments | « ash/display/projecting_observer_chromeos_unittest.cc ('k') | ui/display/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698