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

Side by Side Diff: ash/wm/maximize_mode/maximize_mode_controller_unittest.cc

Issue 934843002: Implement DeviceMotionEvent API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix missed test Created 5 years, 9 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 <math.h> 5 #include <math.h>
6 6
7 #include "ash/wm/maximize_mode/maximize_mode_controller.h" 7 #include "ash/wm/maximize_mode/maximize_mode_controller.h"
8 8
9 #include "ash/ash_switches.h" 9 #include "ash/ash_switches.h"
10 #include "ash/display/display_manager.h" 10 #include "ash/display/display_manager.h"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 chromeos::AccelerometerReader::GetInstance()->AddObserver( 71 chromeos::AccelerometerReader::GetInstance()->AddObserver(
72 maximize_mode_controller()); 72 maximize_mode_controller());
73 test::AshTestBase::TearDown(); 73 test::AshTestBase::TearDown();
74 } 74 }
75 75
76 MaximizeModeController* maximize_mode_controller() { 76 MaximizeModeController* maximize_mode_controller() {
77 return Shell::GetInstance()->maximize_mode_controller(); 77 return Shell::GetInstance()->maximize_mode_controller();
78 } 78 }
79 79
80 void TriggerLidUpdate(const gfx::Vector3dF& lid) { 80 void TriggerLidUpdate(const gfx::Vector3dF& lid) {
81 chromeos::AccelerometerUpdate update; 81 scoped_refptr<chromeos::AccelerometerUpdate> update(
82 update.Set(chromeos::ACCELEROMETER_SOURCE_SCREEN, lid.x(), lid.y(), 82 new chromeos::AccelerometerUpdate());
83 lid.z()); 83 update->Set(chromeos::ACCELEROMETER_SOURCE_SCREEN, lid.x(), lid.y(),
84 lid.z());
84 maximize_mode_controller()->OnAccelerometerUpdated(update); 85 maximize_mode_controller()->OnAccelerometerUpdated(update);
85 } 86 }
86 87
87 void TriggerBaseAndLidUpdate(const gfx::Vector3dF& base, 88 void TriggerBaseAndLidUpdate(const gfx::Vector3dF& base,
88 const gfx::Vector3dF& lid) { 89 const gfx::Vector3dF& lid) {
89 chromeos::AccelerometerUpdate update; 90 scoped_refptr<chromeos::AccelerometerUpdate> update(
90 update.Set(chromeos::ACCELEROMETER_SOURCE_ATTACHED_KEYBOARD, base.x(), 91 new chromeos::AccelerometerUpdate());
91 base.y(), base.z()); 92 update->Set(chromeos::ACCELEROMETER_SOURCE_ATTACHED_KEYBOARD, base.x(),
92 update.Set(chromeos::ACCELEROMETER_SOURCE_SCREEN, lid.x(), lid.y(), 93 base.y(), base.z());
93 lid.z()); 94 update->Set(chromeos::ACCELEROMETER_SOURCE_SCREEN, lid.x(), lid.y(),
95 lid.z());
94 maximize_mode_controller()->OnAccelerometerUpdated(update); 96 maximize_mode_controller()->OnAccelerometerUpdated(update);
95 } 97 }
96 98
97 bool IsMaximizeModeStarted() { 99 bool IsMaximizeModeStarted() {
98 return maximize_mode_controller()->IsMaximizeModeWindowManagerEnabled(); 100 return maximize_mode_controller()->IsMaximizeModeWindowManagerEnabled();
99 } 101 }
100 102
101 gfx::Display::Rotation GetInternalDisplayRotation() const { 103 gfx::Display::Rotation GetInternalDisplayRotation() const {
102 return Shell::GetInstance()->display_manager()->GetDisplayInfo( 104 return Shell::GetInstance()->display_manager()->GetDisplayInfo(
103 gfx::Display::InternalDisplayId()).rotation(); 105 gfx::Display::InternalDisplayId()).rotation();
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 // accelerometer updates which would normally cause it to exit do not. 407 // accelerometer updates which would normally cause it to exit do not.
406 TEST_F(MaximizeModeControllerSwitchesTest, IgnoreHingeAngles) { 408 TEST_F(MaximizeModeControllerSwitchesTest, IgnoreHingeAngles) {
407 maximize_mode_controller()->EnableMaximizeModeWindowManager(true); 409 maximize_mode_controller()->EnableMaximizeModeWindowManager(true);
408 410
409 // Would normally trigger an exit from maximize mode. 411 // Would normally trigger an exit from maximize mode.
410 OpenLidToAngle(90.0f); 412 OpenLidToAngle(90.0f);
411 EXPECT_TRUE(IsMaximizeModeStarted()); 413 EXPECT_TRUE(IsMaximizeModeStarted());
412 } 414 }
413 415
414 } // namespace ash 416 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/maximize_mode/maximize_mode_controller.cc ('k') | chrome/browser/chromeos/display/display_preferences_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698