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

Side by Side Diff: ash/wm/power_button_controller_unittest.cc

Issue 10382211: chromeos: Ignore power button presses when screen is off. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ash/wm/power_button_controller.cc ('k') | chrome/browser/chromeos/power/brightness_observer.h » ('j') | 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 "ash/wm/power_button_controller.h" 5 #include "ash/wm/power_button_controller.h"
6 6
7 #include "ash/shell.h" 7 #include "ash/shell.h"
8 #include "ash/test/ash_test_base.h" 8 #include "ash/test/ash_test_base.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/time.h" 10 #include "base/time.h"
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after
532 controller_->OnPowerButtonEvent(true, base::TimeTicks::Now()); 532 controller_->OnPowerButtonEvent(true, base::TimeTicks::Now());
533 EXPECT_EQ(Shell::GetRootWindow()->bounds().ToString(), 533 EXPECT_EQ(Shell::GetRootWindow()->bounds().ToString(),
534 test_api_->GetBackgroundLayerBounds().ToString()); 534 test_api_->GetBackgroundLayerBounds().ToString());
535 535
536 const gfx::Size kNewSize(400, 300); 536 const gfx::Size kNewSize(400, 300);
537 Shell::GetRootWindow()->SetHostSize(kNewSize); 537 Shell::GetRootWindow()->SetHostSize(kNewSize);
538 EXPECT_EQ(gfx::Rect(kNewSize).ToString(), 538 EXPECT_EQ(gfx::Rect(kNewSize).ToString(),
539 test_api_->GetBackgroundLayerBounds().ToString()); 539 test_api_->GetBackgroundLayerBounds().ToString());
540 } 540 }
541 541
542 // Test that we ignore power button presses when the screen is turned off.
543 TEST_F(PowerButtonControllerTest, IgnorePowerButtonIfScreenIsOff) {
544 controller_->OnLoginStateChanged(user::LOGGED_IN_USER);
545
546 // When the screen brightness is at 0%, we shouldn't do anything in response
547 // to power button presses.
548 controller_->OnScreenBrightnessChanged(0.0);
549 controller_->OnPowerButtonEvent(true, base::TimeTicks::Now());
550 EXPECT_FALSE(test_api_->lock_timer_is_running());
551
552 // After increasing the brightness to 10%, we should start the timer like
553 // usual.
554 controller_->OnScreenBrightnessChanged(10.0);
555 controller_->OnPowerButtonEvent(true, base::TimeTicks::Now());
556 EXPECT_TRUE(test_api_->lock_timer_is_running());
557 }
558
542 } // namespace test 559 } // namespace test
543 } // namespace ash 560 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/power_button_controller.cc ('k') | chrome/browser/chromeos/power/brightness_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698