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

Side by Side Diff: chromeos/power/power_state_override_unittest.cc

Issue 12260029: chromeos: Don't override suspend-on-lid-closed. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: update comment Created 7 years, 10 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
« no previous file with comments | « chromeos/power/power_state_override.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "chromeos/power/power_state_override.h" 5 #include "chromeos/power/power_state_override.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "chromeos/dbus/mock_power_manager_client.h" 10 #include "chromeos/dbus/mock_power_manager_client.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 }; 50 };
51 51
52 TEST_F(PowerStateOverrideTest, AddAndRemoveOverrides) { 52 TEST_F(PowerStateOverrideTest, AddAndRemoveOverrides) {
53 // An arbitrary ID to return in response to a request with ID 0. 53 // An arbitrary ID to return in response to a request with ID 0.
54 const uint32 kRequestId = 10; 54 const uint32 kRequestId = 10;
55 55
56 // Override bitmaps corresponding to different modes. 56 // Override bitmaps corresponding to different modes.
57 const uint32 kDisplayOverrides = 57 const uint32 kDisplayOverrides =
58 PowerManagerClient::DISABLE_IDLE_DIM | 58 PowerManagerClient::DISABLE_IDLE_DIM |
59 PowerManagerClient::DISABLE_IDLE_BLANK | 59 PowerManagerClient::DISABLE_IDLE_BLANK |
60 PowerManagerClient::DISABLE_IDLE_SUSPEND | 60 PowerManagerClient::DISABLE_IDLE_SUSPEND;
61 PowerManagerClient::DISABLE_IDLE_LID_SUSPEND;
62 const uint32 kSystemOverrides = 61 const uint32 kSystemOverrides =
63 PowerManagerClient::DISABLE_IDLE_SUSPEND | 62 PowerManagerClient::DISABLE_IDLE_SUSPEND;
64 PowerManagerClient::DISABLE_IDLE_LID_SUSPEND;
65 63
66 // Block display sleep and pass a request ID to the callback. 64 // Block display sleep and pass a request ID to the callback.
67 chromeos::PowerStateRequestIdCallback request_id_callback; 65 chromeos::PowerStateRequestIdCallback request_id_callback;
68 EXPECT_CALL(*power_manager_client_, 66 EXPECT_CALL(*power_manager_client_,
69 RequestPowerStateOverrides(0, _, kDisplayOverrides, _)) 67 RequestPowerStateOverrides(0, _, kDisplayOverrides, _))
70 .WillOnce(SaveArg<3>(&request_id_callback)); 68 .WillOnce(SaveArg<3>(&request_id_callback));
71 scoped_refptr<PowerStateOverride> override( 69 scoped_refptr<PowerStateOverride> override(
72 new PowerStateOverride(PowerStateOverride::BLOCK_DISPLAY_SLEEP)); 70 new PowerStateOverride(PowerStateOverride::BLOCK_DISPLAY_SLEEP));
73 // Make sure our PostTask to the request power state overrides runs. 71 // Make sure our PostTask to the request power state overrides runs.
74 message_loop_.RunUntilIdle(); 72 message_loop_.RunUntilIdle();
(...skipping 26 matching lines...) Expand all
101 message_loop_.RunUntilIdle(); 99 message_loop_.RunUntilIdle();
102 request_id_callback.Run(kRequestId); 100 request_id_callback.Run(kRequestId);
103 101
104 // When the DBusThreadManager is about to be shut down, PowerStateOverride 102 // When the DBusThreadManager is about to be shut down, PowerStateOverride
105 // should cancel its request. 103 // should cancel its request.
106 EXPECT_CALL(*power_manager_client_, CancelPowerStateOverrides(kRequestId)); 104 EXPECT_CALL(*power_manager_client_, CancelPowerStateOverrides(kRequestId));
107 ShutDownDBusThreadManager(); 105 ShutDownDBusThreadManager();
108 } 106 }
109 107
110 } // namespace chromeos 108 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/power/power_state_override.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698