OLD | NEW |
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 "chrome/browser/chromeos/display/display_preferences.h" | 5 #include "chrome/browser/chromeos/display/display_preferences.h" |
6 | 6 |
| 7 #include <string> |
| 8 #include <vector> |
| 9 |
7 #include "ash/display/display_controller.h" | 10 #include "ash/display/display_controller.h" |
8 #include "ash/display/display_layout_store.h" | 11 #include "ash/display/display_layout_store.h" |
9 #include "ash/display/display_manager.h" | 12 #include "ash/display/display_manager.h" |
10 #include "ash/display/resolution_notification_controller.h" | 13 #include "ash/display/resolution_notification_controller.h" |
11 #include "ash/screen_util.h" | 14 #include "ash/screen_util.h" |
12 #include "ash/shell.h" | 15 #include "ash/shell.h" |
13 #include "ash/test/ash_test_base.h" | 16 #include "ash/test/ash_test_base.h" |
14 #include "ash/test/display_manager_test_api.h" | 17 #include "ash/test/display_manager_test_api.h" |
15 #include "ash/wm/maximize_mode/maximize_mode_controller.h" | 18 #include "ash/wm/maximize_mode/maximize_mode_controller.h" |
16 #include "base/prefs/scoped_user_pref_update.h" | 19 #include "base/prefs/scoped_user_pref_update.h" |
(...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
634 // Populate the properties. | 637 // Populate the properties. |
635 display_manager->SetDisplayRotation(gfx::Display::InternalDisplayId(), | 638 display_manager->SetDisplayRotation(gfx::Display::InternalDisplayId(), |
636 gfx::Display::ROTATE_180); | 639 gfx::Display::ROTATE_180); |
637 // Reset property to avoid rotation lock | 640 // Reset property to avoid rotation lock |
638 display_manager->SetDisplayRotation(gfx::Display::InternalDisplayId(), | 641 display_manager->SetDisplayRotation(gfx::Display::InternalDisplayId(), |
639 gfx::Display::ROTATE_0); | 642 gfx::Display::ROTATE_0); |
640 | 643 |
641 // Open up 270 degrees to trigger maximize mode | 644 // Open up 270 degrees to trigger maximize mode |
642 controller->OnAccelerometerUpdated(gfx::Vector3dF(0.0f, 0.0f, -1.0f), | 645 controller->OnAccelerometerUpdated(gfx::Vector3dF(0.0f, 0.0f, -1.0f), |
643 gfx::Vector3dF(-1.0f, 0.0f, 0.0f)); | 646 gfx::Vector3dF(-1.0f, 0.0f, 0.0f)); |
644 EXPECT_TRUE(shell->IsMaximizeModeWindowManagerEnabled()); | 647 EXPECT_TRUE(controller->IsMaximizeModeWindowManagerEnabled()); |
645 | 648 |
646 // Trigger 90 degree rotation | 649 // Trigger 90 degree rotation |
647 controller->OnAccelerometerUpdated(gfx::Vector3dF(0.0f, 1.0f, 0.0f), | 650 controller->OnAccelerometerUpdated(gfx::Vector3dF(0.0f, 1.0f, 0.0f), |
648 gfx::Vector3dF(0.0f, 1.0f, 0.0f)); | 651 gfx::Vector3dF(0.0f, 1.0f, 0.0f)); |
649 EXPECT_EQ(gfx::Display::ROTATE_90, display_manager-> | 652 EXPECT_EQ(gfx::Display::ROTATE_90, display_manager-> |
650 GetDisplayInfo(gfx::Display::InternalDisplayId()).rotation()); | 653 GetDisplayInfo(gfx::Display::InternalDisplayId()).rotation()); |
651 | 654 |
652 const base::DictionaryValue* properties = | 655 const base::DictionaryValue* properties = |
653 local_state()->GetDictionary(prefs::kDisplayProperties); | 656 local_state()->GetDictionary(prefs::kDisplayProperties); |
654 const base::DictionaryValue* property = NULL; | 657 const base::DictionaryValue* property = NULL; |
655 EXPECT_TRUE(properties->GetDictionary( | 658 EXPECT_TRUE(properties->GetDictionary( |
656 base::Int64ToString(gfx::Display::InternalDisplayId()), &property)); | 659 base::Int64ToString(gfx::Display::InternalDisplayId()), &property)); |
657 int rotation = -1; | 660 int rotation = -1; |
658 EXPECT_TRUE(property->GetInteger("rotation", &rotation)); | 661 EXPECT_TRUE(property->GetInteger("rotation", &rotation)); |
659 EXPECT_EQ(gfx::Display::ROTATE_0, rotation); | 662 EXPECT_EQ(gfx::Display::ROTATE_0, rotation); |
660 } | 663 } |
661 | 664 |
662 } // namespace chromeos | 665 } // namespace chromeos |
OLD | NEW |