Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(79)

Side by Side Diff: content/browser/web_contents/web_contents_view_aura_unittest.cc

Issue 2742383006: Display: set color_depth and depth_per_component value based on kEnableHDROutput (Closed)
Patch Set: rebase Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/web_contents/web_contents_view_aura.h" 5 #include "content/browser/web_contents/web_contents_view_aura.h"
6 6
7 #include "base/command_line.h"
8 #include "base/test/scoped_command_line.h"
7 #include "content/browser/web_contents/web_contents_impl.h" 9 #include "content/browser/web_contents/web_contents_impl.h"
8 #include "content/public/test/test_renderer_host.h" 10 #include "content/public/test/test_renderer_host.h"
9 #include "testing/gtest/include/gtest/gtest.h" 11 #include "testing/gtest/include/gtest/gtest.h"
12 #include "ui/display/display_switches.h"
10 13
11 namespace content { 14 namespace content {
12 15
13 class WebContentsViewAuraTest : public RenderViewHostTestHarness { 16 class WebContentsViewAuraTest : public RenderViewHostTestHarness {
14 public: 17 public:
15 WebContentsViewAuraTest() {} 18 WebContentsViewAuraTest() = default;
16 ~WebContentsViewAuraTest() override {} 19 ~WebContentsViewAuraTest() override = default;
17 20
18 WebContentsViewAura* view() { 21 WebContentsViewAura* view() {
19 WebContentsImpl* contents = static_cast<WebContentsImpl*>(web_contents()); 22 WebContentsImpl* contents = static_cast<WebContentsImpl*>(web_contents());
20 return static_cast<WebContentsViewAura*>(contents->GetView()); 23 return static_cast<WebContentsViewAura*>(contents->GetView());
21 } 24 }
22 }; 25 };
23 26
24 TEST_F(WebContentsViewAuraTest, EnableDisableOverscroll) { 27 TEST_F(WebContentsViewAuraTest, EnableDisableOverscroll) {
25 WebContentsViewAura* wcva = view(); 28 WebContentsViewAura* wcva = view();
26 wcva->SetOverscrollControllerEnabled(false); 29 wcva->SetOverscrollControllerEnabled(false);
27 EXPECT_FALSE(wcva->navigation_overlay_); 30 EXPECT_FALSE(wcva->navigation_overlay_);
28 wcva->SetOverscrollControllerEnabled(true); 31 wcva->SetOverscrollControllerEnabled(true);
29 EXPECT_TRUE(wcva->navigation_overlay_); 32 EXPECT_TRUE(wcva->navigation_overlay_);
30 } 33 }
31 34
35 TEST_F(WebContentsViewAuraTest, ScreenInfoColorDepth) {
36 WebContentsView* web_contents_view = view();
37
38 ScreenInfo screen_info;
39 web_contents_view->GetScreenInfo(&screen_info);
40 EXPECT_EQ(24u, screen_info.depth);
41 EXPECT_EQ(8u, screen_info.depth_per_component);
42 }
43
44 // This test class is used when we want to have the kEnableHDROutput flag on.
45 class WebContentsViewAuraHDRTest : public WebContentsViewAuraTest {
46 public:
47 WebContentsViewAuraHDRTest() = default;
48 ~WebContentsViewAuraHDRTest() override = default;
49
50 void SetUp() override {
51 base::CommandLine* command_line =
52 scoped_command_line_.GetProcessCommandLine();
53 command_line->AppendSwitch(switches::kEnableHDR);
54 WebContentsViewAuraTest::SetUp();
55 }
56
57 private:
58 base::test::ScopedCommandLine scoped_command_line_;
59 };
60
61 TEST_F(WebContentsViewAuraHDRTest, ScreenInfoColorDepth) {
62 WebContentsView* web_contents_view = view();
63
64 ScreenInfo screen_info;
65 web_contents_view->GetScreenInfo(&screen_info);
66 EXPECT_EQ(48u, screen_info.depth);
67 EXPECT_EQ(16u, screen_info.depth_per_component);
68 }
69
32 } // namespace content 70 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/web_contents/web_contents_view_aura.cc ('k') | content/renderer/media/render_media_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698