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 "content/browser/renderer_host/render_widget_host_view_base.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_base.h" |
6 | 6 |
7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
8 #include "third_party/WebKit/public/platform/modules/screen_orientation/WebScree
nOrientationType.h" | 8 #include "third_party/WebKit/public/platform/modules/screen_orientation/WebScree
nOrientationType.h" |
9 #include "ui/gfx/display.h" | 9 #include "ui/gfx/display.h" |
10 | 10 |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 display = CreateDisplay(100, 200, 180); | 74 display = CreateDisplay(100, 200, 180); |
75 EXPECT_EQ(blink::WebScreenOrientationPortraitSecondary, | 75 EXPECT_EQ(blink::WebScreenOrientationPortraitSecondary, |
76 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display)); | 76 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display)); |
77 | 77 |
78 display = CreateDisplay(10000, 1, 270); | 78 display = CreateDisplay(10000, 1, 270); |
79 EXPECT_EQ(blink::WebScreenOrientationLandscapeSecondary, | 79 EXPECT_EQ(blink::WebScreenOrientationLandscapeSecondary, |
80 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display)); | 80 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display)); |
81 } | 81 } |
82 } | 82 } |
83 | 83 |
84 // Fails on memory bots on all platforms. http://crbug.com/499914 | 84 TEST(RenderWidgetHostViewBaseTest, OrientationTypeForDesktop) { |
85 TEST(RenderWidgetHostViewBaseTest, DISABLED_OrientationTypeForDesktop) { | |
86 // On Desktop, the primary orientation is the first computed one so a test | 85 // On Desktop, the primary orientation is the first computed one so a test |
87 // similar to OrientationTypeForMobile is not possible. | 86 // similar to OrientationTypeForMobile is not possible. |
88 // Instead this test will only check one configuration and verify that the | 87 // Instead this test will only check one configuration and verify that the |
89 // method reports two landscape and two portrait orientations with one primary | 88 // method reports two landscape and two portrait orientations with one primary |
90 // and one secondary for each. | 89 // and one secondary for each. |
91 | 90 |
92 // natural width > natural height. | 91 // natural width > natural height. |
93 { | 92 { |
94 gfx::Display display = CreateDisplay(1, 0, 0); | 93 gfx::Display display = CreateDisplay(1, 0, 0); |
95 blink::WebScreenOrientationType landscape_1 = | 94 blink::WebScreenOrientationType landscape_1 = |
(...skipping 20 matching lines...) Expand all Loading... |
116 RenderWidgetHostViewBase::GetOrientationTypeForDesktop(display); | 115 RenderWidgetHostViewBase::GetOrientationTypeForDesktop(display); |
117 EXPECT_TRUE(portrait_2 == blink::WebScreenOrientationPortraitPrimary || | 116 EXPECT_TRUE(portrait_2 == blink::WebScreenOrientationPortraitPrimary || |
118 portrait_2 == blink::WebScreenOrientationPortraitSecondary); | 117 portrait_2 == blink::WebScreenOrientationPortraitSecondary); |
119 | 118 |
120 EXPECT_NE(portrait_1, portrait_2); | 119 EXPECT_NE(portrait_1, portrait_2); |
121 | 120 |
122 } | 121 } |
123 } | 122 } |
124 | 123 |
125 } // namespace content | 124 } // namespace content |
OLD | NEW |