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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 content::WebContents* | 154 content::WebContents* |
155 ScreenOrientationControllerTest::CreateSecondaryWebContents() { | 155 ScreenOrientationControllerTest::CreateSecondaryWebContents() { |
156 secondary_browser_context_.reset(new content::TestBrowserContext()); | 156 secondary_browser_context_.reset(new content::TestBrowserContext()); |
157 return views::ViewsDelegate::GetInstance()->CreateWebContents( | 157 return views::ViewsDelegate::GetInstance()->CreateWebContents( |
158 secondary_browser_context_.get(), nullptr); | 158 secondary_browser_context_.get(), nullptr); |
159 } | 159 } |
160 | 160 |
161 void ScreenOrientationControllerTest::SetUp() { | 161 void ScreenOrientationControllerTest::SetUp() { |
162 base::CommandLine::ForCurrentProcess()->AppendSwitch( | 162 base::CommandLine::ForCurrentProcess()->AppendSwitch( |
163 ::switches::kUseFirstDisplayAsInternal); | 163 ::switches::kUseFirstDisplayAsInternal); |
164 base::CommandLine::ForCurrentProcess()->AppendSwitch( | |
165 switches::kAshEnableTouchViewTesting); | |
166 test::AshTestBase::SetUp(); | 164 test::AshTestBase::SetUp(); |
167 } | 165 } |
168 | 166 |
169 // Tests that a content::WebContents can lock rotation. | 167 // Tests that a content::WebContents can lock rotation. |
170 TEST_F(ScreenOrientationControllerTest, LockOrientation) { | 168 TEST_F(ScreenOrientationControllerTest, LockOrientation) { |
171 std::unique_ptr<content::WebContents> content(CreateWebContents()); | 169 std::unique_ptr<content::WebContents> content(CreateWebContents()); |
172 std::unique_ptr<aura::Window> focus_window(CreateTestWindowInShellWithId(0)); | 170 std::unique_ptr<aura::Window> focus_window(CreateTestWindowInShellWithId(0)); |
173 ASSERT_NE(nullptr, content->GetNativeView()); | 171 ASSERT_NE(nullptr, content->GetNativeView()); |
174 ASSERT_EQ(display::Display::ROTATE_0, GetCurrentInternalDisplayRotation()); | 172 ASSERT_EQ(display::Display::ROTATE_0, GetCurrentInternalDisplayRotation()); |
175 ASSERT_FALSE(RotationLocked()); | 173 ASSERT_FALSE(RotationLocked()); |
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
660 | 658 |
661 Shell::GetInstance()->screen_orientation_controller()->SetDisplayRotation( | 659 Shell::GetInstance()->screen_orientation_controller()->SetDisplayRotation( |
662 kNewRotation, display::Display::ROTATION_SOURCE_ACTIVE); | 660 kNewRotation, display::Display::ROTATION_SOURCE_ACTIVE); |
663 | 661 |
664 EXPECT_EQ(kNewRotation, display_manager() | 662 EXPECT_EQ(kNewRotation, display_manager() |
665 ->GetDisplayInfo(kInternalDisplayId) | 663 ->GetDisplayInfo(kInternalDisplayId) |
666 .GetActiveRotation()); | 664 .GetActiveRotation()); |
667 } | 665 } |
668 | 666 |
669 } // namespace ash | 667 } // namespace ash |
OLD | NEW |