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 "ash/display/screen_orientation_controller_chromeos.h" | 5 #include "ash/display/screen_orientation_controller_chromeos.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "ash/ash_switches.h" | 10 #include "ash/ash_switches.h" |
11 #include "ash/content/shell_content_state.h" | 11 #include "ash/content/shell_content_state.h" |
12 #include "ash/display/screen_orientation_controller_chromeos.h" | 12 #include "ash/display/screen_orientation_controller_chromeos.h" |
13 #include "ash/shared/app_types.h" | 13 #include "ash/shared/app_types.h" |
14 #include "ash/shell.h" | 14 #include "ash/shell.h" |
15 #include "ash/system/screen_layout_observer.h" | 15 #include "ash/system/screen_layout_observer.h" |
16 #include "ash/test/ash_test_base.h" | 16 #include "ash/test/ash_test_base.h" |
17 #include "ash/test/ash_test_environment_content.h" | 17 #include "ash/test/ash_test_environment_content.h" |
18 #include "ash/test/ash_test_helper.h" | 18 #include "ash/test/ash_test_helper.h" |
19 #include "ash/test/content/test_shell_content_state.h" | 19 #include "ash/test/content/test_shell_content_state.h" |
20 #include "ash/test/screen_orientation_controller_test_api.h" | 20 #include "ash/test/screen_orientation_controller_test_api.h" |
21 #include "ash/test/test_shell_delegate.h" | 21 #include "ash/test/test_shell_delegate.h" |
22 #include "ash/test/test_system_tray_delegate.h" | 22 #include "ash/test/test_system_tray_delegate.h" |
23 #include "ash/wm/maximize_mode/maximize_mode_controller.h" | 23 #include "ash/wm/maximize_mode/maximize_mode_controller.h" |
24 #include "ash/wm/window_state.h" | 24 #include "ash/wm/window_state.h" |
25 #include "ash/wm_window.h" | |
26 #include "base/command_line.h" | 25 #include "base/command_line.h" |
27 #include "chromeos/accelerometer/accelerometer_reader.h" | 26 #include "chromeos/accelerometer/accelerometer_reader.h" |
28 #include "chromeos/accelerometer/accelerometer_types.h" | 27 #include "chromeos/accelerometer/accelerometer_types.h" |
29 #include "content/public/browser/browser_context.h" | 28 #include "content/public/browser/browser_context.h" |
30 #include "content/public/browser/web_contents.h" | 29 #include "content/public/browser/web_contents.h" |
31 #include "content/public/test/test_browser_context.h" | 30 #include "content/public/test/test_browser_context.h" |
32 #include "third_party/WebKit/public/platform/modules/screen_orientation/WebScree
nOrientationLockType.h" | 31 #include "third_party/WebKit/public/platform/modules/screen_orientation/WebScree
nOrientationLockType.h" |
| 32 #include "ui/aura/client/aura_constants.h" |
33 #include "ui/aura/window.h" | 33 #include "ui/aura/window.h" |
34 #include "ui/display/display.h" | 34 #include "ui/display/display.h" |
35 #include "ui/display/display_switches.h" | 35 #include "ui/display/display_switches.h" |
36 #include "ui/display/manager/display_manager.h" | 36 #include "ui/display/manager/display_manager.h" |
37 #include "ui/display/manager/managed_display_info.h" | 37 #include "ui/display/manager/managed_display_info.h" |
38 #include "ui/display/test/display_manager_test_api.h" | 38 #include "ui/display/test/display_manager_test_api.h" |
39 #include "ui/message_center/message_center.h" | 39 #include "ui/message_center/message_center.h" |
40 #include "ui/views/test/webview_test_helper.h" | 40 #include "ui/views/test/webview_test_helper.h" |
41 #include "ui/views/view.h" | 41 #include "ui/views/view.h" |
42 #include "ui/views/views_delegate.h" | 42 #include "ui/views/views_delegate.h" |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 // Creates a secondary content::WebContents, with a separate | 125 // Creates a secondary content::WebContents, with a separate |
126 // content::BrowserContext. | 126 // content::BrowserContext. |
127 content::WebContents* CreateSecondaryWebContents(); | 127 content::WebContents* CreateSecondaryWebContents(); |
128 | 128 |
129 // test::AshTestBase: | 129 // test::AshTestBase: |
130 void SetUp() override; | 130 void SetUp() override; |
131 | 131 |
132 protected: | 132 protected: |
133 aura::Window* CreateAppWindowInShellWithId(int id) { | 133 aura::Window* CreateAppWindowInShellWithId(int id) { |
134 aura::Window* window = CreateTestWindowInShellWithId(id); | 134 aura::Window* window = CreateTestWindowInShellWithId(id); |
135 WmWindow::Get(window)->SetAppType(static_cast<int>(AppType::CHROME_APP)); | 135 window->SetProperty(aura::client::kAppType, |
| 136 static_cast<int>(AppType::CHROME_APP)); |
136 return window; | 137 return window; |
137 } | 138 } |
138 | 139 |
139 void SetSystemRotationLocked(bool rotation_locked) { | 140 void SetSystemRotationLocked(bool rotation_locked) { |
140 test::ScreenOrientationControllerTestApi( | 141 test::ScreenOrientationControllerTestApi( |
141 Shell::Get()->screen_orientation_controller()) | 142 Shell::Get()->screen_orientation_controller()) |
142 .SetRotationLocked(rotation_locked); | 143 .SetRotationLocked(rotation_locked); |
143 } | 144 } |
144 | 145 |
145 void SetUserRotationLocked(bool rotation_locked) { | 146 void SetUserRotationLocked(bool rotation_locked) { |
(...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
792 delegate()->Lock(content2.get(), blink::kWebScreenOrientationLockLandscape); | 793 delegate()->Lock(content2.get(), blink::kWebScreenOrientationLockLandscape); |
793 EXPECT_EQ(display::Display::ROTATE_0, GetCurrentInternalDisplayRotation()); | 794 EXPECT_EQ(display::Display::ROTATE_0, GetCurrentInternalDisplayRotation()); |
794 | 795 |
795 delegate()->Lock(content1.get(), blink::kWebScreenOrientationLockAny); | 796 delegate()->Lock(content1.get(), blink::kWebScreenOrientationLockAny); |
796 activation_client->ActivateWindow(focus_window1.get()); | 797 activation_client->ActivateWindow(focus_window1.get()); |
797 // Switching back to any will rotate to user rotation. | 798 // Switching back to any will rotate to user rotation. |
798 EXPECT_EQ(display::Display::ROTATE_90, GetCurrentInternalDisplayRotation()); | 799 EXPECT_EQ(display::Display::ROTATE_90, GetCurrentInternalDisplayRotation()); |
799 } | 800 } |
800 | 801 |
801 } // namespace ash | 802 } // namespace ash |
OLD | NEW |