OLD | NEW |
---|---|
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 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
339 kAccelerometerFullyOpenTestData[i * 6 + 3], | 339 kAccelerometerFullyOpenTestData[i * 6 + 3], |
340 kAccelerometerFullyOpenTestData[i * 6 + 5]); | 340 kAccelerometerFullyOpenTestData[i * 6 + 5]); |
341 lid.Scale(kMeanGravity); | 341 lid.Scale(kMeanGravity); |
342 TriggerBaseAndLidUpdate(base, lid); | 342 TriggerBaseAndLidUpdate(base, lid); |
343 // There are a lot of samples, so ASSERT rather than EXPECT to only generate | 343 // There are a lot of samples, so ASSERT rather than EXPECT to only generate |
344 // one failure rather than potentially hundreds. | 344 // one failure rather than potentially hundreds. |
345 ASSERT_TRUE(IsMaximizeModeStarted()); | 345 ASSERT_TRUE(IsMaximizeModeStarted()); |
346 } | 346 } |
347 } | 347 } |
348 | 348 |
349 // Tests that when and empty accelerometer update is received for attaching as a | |
flackr
2015/02/06 20:18:20
nit s/and/an
Also comment is stale, we don't recei
jonross
2015/02/09 14:54:48
Done.
| |
350 // chromeos::AccelerometerReader::Observer, that CanEnterMaximizeMode returns | |
351 // false, and that valid accelerometer events allow entering maximize mode. | |
352 TEST_F(MaximizeModeControllerTest, | |
353 CanEnterMaximizeModeRequiresValidAccelerometerUpdate) { | |
354 // Should be false until an accelerometer event is sent. | |
355 ASSERT_FALSE(maximize_mode_controller()->CanEnterMaximizeMode()); | |
356 OpenLidToAngle(90.0f); | |
357 EXPECT_TRUE(maximize_mode_controller()->CanEnterMaximizeMode()); | |
358 } | |
359 | |
360 // Tests that when an accelerometer event is received which has no keyboard that | |
361 // we enter maximize mode. | |
362 TEST_F(MaximizeModeControllerTest, | |
363 NoKeyboardAccelerometerTriggersMaximizeMode) { | |
364 ASSERT_FALSE(IsMaximizeModeStarted()); | |
365 TriggerLidUpdate(gfx::Vector3dF(0.0f, 0.0f, kMeanGravity)); | |
366 ASSERT_TRUE(IsMaximizeModeStarted()); | |
367 } | |
368 | |
349 class MaximizeModeControllerSwitchesTest : public MaximizeModeControllerTest { | 369 class MaximizeModeControllerSwitchesTest : public MaximizeModeControllerTest { |
350 public: | 370 public: |
351 MaximizeModeControllerSwitchesTest() {} | 371 MaximizeModeControllerSwitchesTest() {} |
352 ~MaximizeModeControllerSwitchesTest() override {} | 372 ~MaximizeModeControllerSwitchesTest() override {} |
353 | 373 |
354 void SetUp() override { | 374 void SetUp() override { |
355 base::CommandLine::ForCurrentProcess()->AppendSwitch( | 375 base::CommandLine::ForCurrentProcess()->AppendSwitch( |
356 switches::kAshEnableTouchViewTesting); | 376 switches::kAshEnableTouchViewTesting); |
357 MaximizeModeControllerTest::SetUp(); | 377 MaximizeModeControllerTest::SetUp(); |
358 } | 378 } |
359 private: | 379 private: |
360 DISALLOW_COPY_AND_ASSIGN(MaximizeModeControllerSwitchesTest); | 380 DISALLOW_COPY_AND_ASSIGN(MaximizeModeControllerSwitchesTest); |
361 }; | 381 }; |
362 | 382 |
363 // Tests that when the command line switch for testing maximize mode is on, that | 383 // Tests that when the command line switch for testing maximize mode is on, that |
364 // accelerometer updates which would normally cause it to exit do not. | 384 // accelerometer updates which would normally cause it to exit do not. |
365 TEST_F(MaximizeModeControllerSwitchesTest, IgnoreHingeAngles) { | 385 TEST_F(MaximizeModeControllerSwitchesTest, IgnoreHingeAngles) { |
366 maximize_mode_controller()->EnableMaximizeModeWindowManager(true); | 386 maximize_mode_controller()->EnableMaximizeModeWindowManager(true); |
367 | 387 |
368 // Would normally trigger an exit from maximize mode. | 388 // Would normally trigger an exit from maximize mode. |
369 OpenLidToAngle(90.0f); | 389 OpenLidToAngle(90.0f); |
370 EXPECT_TRUE(IsMaximizeModeStarted()); | 390 EXPECT_TRUE(IsMaximizeModeStarted()); |
371 } | 391 } |
372 | 392 |
373 } // namespace ash | 393 } // namespace ash |
OLD | NEW |