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

Unified Diff: ui/display/chromeos/display_configurator_unittest.cc

Issue 1130823003: Wait for display configuration to finish before suspending (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: unittests Created 5 years, 7 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
Index: ui/display/chromeos/display_configurator_unittest.cc
diff --git a/ui/display/chromeos/display_configurator_unittest.cc b/ui/display/chromeos/display_configurator_unittest.cc
index 9000af6ccc13d5c5aad4ba9837917048497b322e..0b4fe020b9d351ad30f8c01a6e5828e745802565 100644
--- a/ui/display/chromeos/display_configurator_unittest.cc
+++ b/ui/display/chromeos/display_configurator_unittest.cc
@@ -659,7 +659,9 @@ TEST_F(DisplayConfiguratorTest, SuspendAndResume) {
// was connected while suspended.
const gfx::Size framebuffer_size = configurator_.framebuffer_size();
DCHECK(!framebuffer_size.IsEmpty());
- configurator_.SuspendDisplays();
+ configurator_.SuspendDisplays(base::Bind(
+ &DisplayConfiguratorTest::OnConfiguredCallback, base::Unretained(this)));
+ EXPECT_EQ(CALLBACK_SUCCESS, PopCallbackResult());
EXPECT_EQ(framebuffer_size.ToString(),
configurator_.framebuffer_size().ToString());
EXPECT_EQ(kNoActions, log_->GetActionsAndClear());
@@ -692,7 +694,9 @@ TEST_F(DisplayConfiguratorTest, SuspendAndResume) {
NULL),
log_->GetActionsAndClear());
- configurator_.SuspendDisplays();
+ configurator_.SuspendDisplays(base::Bind(
+ &DisplayConfiguratorTest::OnConfiguredCallback, base::Unretained(this)));
+ EXPECT_EQ(CALLBACK_SUCCESS, PopCallbackResult());
EXPECT_EQ(
JoinActions(
kGrab,
@@ -747,7 +751,9 @@ TEST_F(DisplayConfiguratorTest, SuspendAndResume) {
NULL),
log_->GetActionsAndClear());
- configurator_.SuspendDisplays();
+ configurator_.SuspendDisplays(base::Bind(
+ &DisplayConfiguratorTest::OnConfiguredCallback, base::Unretained(this)));
+ EXPECT_EQ(CALLBACK_SUCCESS, PopCallbackResult());
EXPECT_EQ(JoinActions(kGrab, kUngrab, kSync, NULL),
log_->GetActionsAndClear());
@@ -1020,7 +1026,9 @@ TEST_F(DisplayConfiguratorTest, DoNotConfigureWithSuspendedDisplays) {
// after the displays have been suspended. This event should be ignored since
// the DisplayConfigurator will force a probe and reconfiguration of displays
// at resume time.
- configurator_.SuspendDisplays();
+ configurator_.SuspendDisplays(base::Bind(
+ &DisplayConfiguratorTest::OnConfiguredCallback, base::Unretained(this)));
+ EXPECT_EQ(CALLBACK_SUCCESS, PopCallbackResult());
EXPECT_EQ(kNoActions, log_->GetActionsAndClear());
// The configuration timer should not be started when the displays
@@ -1091,7 +1099,9 @@ TEST_F(DisplayConfiguratorTest, DoNotConfigureWithSuspendedDisplays) {
// If a configuration task is pending when the displays are suspended, that
// task should not run either and the timer should be stopped.
configurator_.OnConfigurationChanged();
- configurator_.SuspendDisplays();
+ configurator_.SuspendDisplays(base::Bind(
+ &DisplayConfiguratorTest::OnConfiguredCallback, base::Unretained(this)));
+ EXPECT_EQ(CALLBACK_SUCCESS, PopCallbackResult());
EXPECT_EQ(kNoActions, log_->GetActionsAndClear());
EXPECT_FALSE(test_api_.TriggerConfigureTimeout());
@@ -1380,7 +1390,9 @@ TEST_F(DisplayConfiguratorTest, DontRestoreStalePowerStateAfterResume) {
// Suspend and resume the system. Resuming should post a task to restore the
// previous power state, additionally forcing a probe.
- configurator_.SuspendDisplays();
+ configurator_.SuspendDisplays(base::Bind(
+ &DisplayConfiguratorTest::OnConfiguredCallback, base::Unretained(this)));
+ EXPECT_EQ(CALLBACK_SUCCESS, PopCallbackResult());
configurator_.ResumeDisplays();
// Before the task runs, exit docked mode.
« ui/display/chromeos/display_configurator.h ('K') | « ui/display/chromeos/display_configurator.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698