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/common/ash_switches.h" | 10 #include "ash/common/ash_switches.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 #include "ash/test/test_system_tray_delegate.h" | 22 #include "ash/test/test_system_tray_delegate.h" |
23 #include "base/command_line.h" | 23 #include "base/command_line.h" |
24 #include "chromeos/accelerometer/accelerometer_reader.h" | 24 #include "chromeos/accelerometer/accelerometer_reader.h" |
25 #include "chromeos/accelerometer/accelerometer_types.h" | 25 #include "chromeos/accelerometer/accelerometer_types.h" |
26 #include "content/public/browser/browser_context.h" | 26 #include "content/public/browser/browser_context.h" |
27 #include "content/public/browser/web_contents.h" | 27 #include "content/public/browser/web_contents.h" |
28 #include "content/public/test/test_browser_context.h" | 28 #include "content/public/test/test_browser_context.h" |
29 #include "third_party/WebKit/public/platform/modules/screen_orientation/WebScree
nOrientationLockType.h" | 29 #include "third_party/WebKit/public/platform/modules/screen_orientation/WebScree
nOrientationLockType.h" |
30 #include "ui/aura/window.h" | 30 #include "ui/aura/window.h" |
31 #include "ui/display/display.h" | 31 #include "ui/display/display.h" |
| 32 #include "ui/display/display_switches.h" |
32 #include "ui/display/manager/managed_display_info.h" | 33 #include "ui/display/manager/managed_display_info.h" |
33 #include "ui/message_center/message_center.h" | 34 #include "ui/message_center/message_center.h" |
34 #include "ui/views/test/webview_test_helper.h" | 35 #include "ui/views/test/webview_test_helper.h" |
35 #include "ui/views/view.h" | 36 #include "ui/views/view.h" |
36 #include "ui/views/views_delegate.h" | 37 #include "ui/views/views_delegate.h" |
37 #include "ui/wm/public/activation_client.h" | 38 #include "ui/wm/public/activation_client.h" |
38 | 39 |
39 namespace ash { | 40 namespace ash { |
40 | 41 |
41 namespace { | 42 namespace { |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 | 152 |
152 content::WebContents* | 153 content::WebContents* |
153 ScreenOrientationControllerTest::CreateSecondaryWebContents() { | 154 ScreenOrientationControllerTest::CreateSecondaryWebContents() { |
154 secondary_browser_context_.reset(new content::TestBrowserContext()); | 155 secondary_browser_context_.reset(new content::TestBrowserContext()); |
155 return views::ViewsDelegate::GetInstance()->CreateWebContents( | 156 return views::ViewsDelegate::GetInstance()->CreateWebContents( |
156 secondary_browser_context_.get(), nullptr); | 157 secondary_browser_context_.get(), nullptr); |
157 } | 158 } |
158 | 159 |
159 void ScreenOrientationControllerTest::SetUp() { | 160 void ScreenOrientationControllerTest::SetUp() { |
160 base::CommandLine::ForCurrentProcess()->AppendSwitch( | 161 base::CommandLine::ForCurrentProcess()->AppendSwitch( |
161 switches::kAshUseFirstDisplayAsInternal); | 162 ::switches::kUseFirstDisplayAsInternal); |
162 base::CommandLine::ForCurrentProcess()->AppendSwitch( | 163 base::CommandLine::ForCurrentProcess()->AppendSwitch( |
163 switches::kAshEnableTouchViewTesting); | 164 switches::kAshEnableTouchViewTesting); |
164 test::AshTestBase::SetUp(); | 165 test::AshTestBase::SetUp(); |
165 } | 166 } |
166 | 167 |
167 // Tests that a content::WebContents can lock rotation. | 168 // Tests that a content::WebContents can lock rotation. |
168 TEST_F(ScreenOrientationControllerTest, LockOrientation) { | 169 TEST_F(ScreenOrientationControllerTest, LockOrientation) { |
169 std::unique_ptr<content::WebContents> content(CreateWebContents()); | 170 std::unique_ptr<content::WebContents> content(CreateWebContents()); |
170 std::unique_ptr<aura::Window> focus_window(CreateTestWindowInShellWithId(0)); | 171 std::unique_ptr<aura::Window> focus_window(CreateTestWindowInShellWithId(0)); |
171 ASSERT_NE(nullptr, content->GetNativeView()); | 172 ASSERT_NE(nullptr, content->GetNativeView()); |
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
654 | 655 |
655 Shell::GetInstance()->screen_orientation_controller()->SetDisplayRotation( | 656 Shell::GetInstance()->screen_orientation_controller()->SetDisplayRotation( |
656 kNewRotation, display::Display::ROTATION_SOURCE_ACTIVE); | 657 kNewRotation, display::Display::ROTATION_SOURCE_ACTIVE); |
657 | 658 |
658 EXPECT_EQ( | 659 EXPECT_EQ( |
659 kNewRotation, | 660 kNewRotation, |
660 display_manager->GetDisplayInfo(kInternalDisplayId).GetActiveRotation()); | 661 display_manager->GetDisplayInfo(kInternalDisplayId).GetActiveRotation()); |
661 } | 662 } |
662 | 663 |
663 } // namespace ash | 664 } // namespace ash |
OLD | NEW |