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

Side by Side Diff: ash/system/chromeos/power/power_event_observer_unittest.cc

Issue 240343004: chromeos: Update IdleActionImminent and SuspendDone handling (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge Created 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "ash/system/chromeos/power/power_event_observer.h" 5 #include "ash/system/chromeos/power/power_event_observer.h"
6 6
7 #include "ash/test/ash_test_base.h" 7 #include "ash/test/ash_test_base.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/time/time.h" 9 #include "base/time/time.h"
10 #include "chromeos/dbus/dbus_thread_manager.h" 10 #include "chromeos/dbus/dbus_thread_manager.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 SetShouldLockScreenBeforeSuspending(true); 46 SetShouldLockScreenBeforeSuspending(true);
47 observer_->SuspendImminent(); 47 observer_->SuspendImminent();
48 EXPECT_EQ(1, client->GetNumPendingSuspendReadinessCallbacks()); 48 EXPECT_EQ(1, client->GetNumPendingSuspendReadinessCallbacks());
49 49
50 // It should run the callback when it hears that the screen is locked. 50 // It should run the callback when it hears that the screen is locked.
51 observer_->ScreenIsLocked(); 51 observer_->ScreenIsLocked();
52 RunAllPendingInMessageLoop(); 52 RunAllPendingInMessageLoop();
53 EXPECT_EQ(0, client->GetNumPendingSuspendReadinessCallbacks()); 53 EXPECT_EQ(0, client->GetNumPendingSuspendReadinessCallbacks());
54 54
55 // If the system is already locked, no callback should be requested. 55 // If the system is already locked, no callback should be requested.
56 observer_->SystemResumed(base::TimeDelta()); 56 observer_->SuspendDone(base::TimeDelta());
57 observer_->ScreenIsUnlocked(); 57 observer_->ScreenIsUnlocked();
58 observer_->ScreenIsLocked(); 58 observer_->ScreenIsLocked();
59 observer_->SuspendImminent(); 59 observer_->SuspendImminent();
60 EXPECT_EQ(0, client->GetNumPendingSuspendReadinessCallbacks()); 60 EXPECT_EQ(0, client->GetNumPendingSuspendReadinessCallbacks());
61 61
62 // It also shouldn't request a callback if it isn't instructed to lock the 62 // It also shouldn't request a callback if it isn't instructed to lock the
63 // screen. 63 // screen.
64 observer_->SystemResumed(base::TimeDelta()); 64 observer_->SuspendDone(base::TimeDelta());
65 SetShouldLockScreenBeforeSuspending(false); 65 SetShouldLockScreenBeforeSuspending(false);
66 observer_->SuspendImminent(); 66 observer_->SuspendImminent();
67 EXPECT_EQ(0, client->GetNumPendingSuspendReadinessCallbacks()); 67 EXPECT_EQ(0, client->GetNumPendingSuspendReadinessCallbacks());
68 } 68 }
69 69
70 } // namespace ash 70 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698