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

Side by Side Diff: ui/display/screen_unittest.cc

Issue 2613493002: Fix namespace for src/ui/display/. (Closed)
Patch Set: Rebase. Created 3 years, 11 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
« no previous file with comments | « ui/display/screen.cc ('k') | ui/display/test/display_manager_test_api.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ui/display/screen.h" 5 #include "ui/display/screen.h"
6 6
7 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
8 #include "ui/display/display.h" 8 #include "ui/display/display.h"
9 #include "ui/display/test/test_screen.h" 9 #include "ui/display/test/test_screen.h"
10 10
11 namespace display { 11 namespace display {
12 12
13 namespace { 13 namespace {
14 14
15 const int DEFAULT_DISPLAY_ID = 0x1337; 15 const int DEFAULT_DISPLAY_ID = 0x1337;
16 const int DEFAULT_DISPLAY_WIDTH = 2560; 16 const int DEFAULT_DISPLAY_WIDTH = 2560;
17 const int DEFAULT_DISPLAY_HEIGHT = 1440; 17 const int DEFAULT_DISPLAY_HEIGHT = 1440;
18 18
19 } // namespace 19 } // namespace
20 20
21 class ScreenTest : public testing::Test { 21 class ScreenTest : public testing::Test {
22 protected: 22 protected:
23 ScreenTest() { 23 ScreenTest() {
24 const display::Display test_display = test_screen_.GetPrimaryDisplay(); 24 const Display test_display = test_screen_.GetPrimaryDisplay();
25 display::Display display(test_display); 25 Display display(test_display);
26 display.set_id(DEFAULT_DISPLAY_ID); 26 display.set_id(DEFAULT_DISPLAY_ID);
27 display.set_bounds( 27 display.set_bounds(
28 gfx::Rect(0, 0, DEFAULT_DISPLAY_WIDTH, DEFAULT_DISPLAY_HEIGHT)); 28 gfx::Rect(0, 0, DEFAULT_DISPLAY_WIDTH, DEFAULT_DISPLAY_HEIGHT));
29 test_screen_.display_list().RemoveDisplay(test_display.id()); 29 test_screen_.display_list().RemoveDisplay(test_display.id());
30 test_screen_.display_list().AddDisplay(display, 30 test_screen_.display_list().AddDisplay(display, DisplayList::Type::PRIMARY);
31 display::DisplayList::Type::PRIMARY);
32 Screen::SetScreenInstance(&test_screen_); 31 Screen::SetScreenInstance(&test_screen_);
33 } 32 }
34 33
35 ~ScreenTest() override { Screen::SetScreenInstance(nullptr); } 34 ~ScreenTest() override { Screen::SetScreenInstance(nullptr); }
36 35
37 private: 36 private:
38 display::test::TestScreen test_screen_; 37 test::TestScreen test_screen_;
39 38
40 DISALLOW_COPY_AND_ASSIGN(ScreenTest); 39 DISALLOW_COPY_AND_ASSIGN(ScreenTest);
41 }; 40 };
42 41
43 TEST_F(ScreenTest, GetPrimaryDisplaySize) { 42 TEST_F(ScreenTest, GetPrimaryDisplaySize) {
44 const gfx::Size size = Screen::GetScreen()->GetPrimaryDisplay().size(); 43 const gfx::Size size = Screen::GetScreen()->GetPrimaryDisplay().size();
45 EXPECT_EQ(DEFAULT_DISPLAY_WIDTH, size.width()); 44 EXPECT_EQ(DEFAULT_DISPLAY_WIDTH, size.width());
46 EXPECT_EQ(DEFAULT_DISPLAY_HEIGHT, size.height()); 45 EXPECT_EQ(DEFAULT_DISPLAY_HEIGHT, size.height());
47 } 46 }
48 47
49 TEST_F(ScreenTest, GetNumDisplays) { 48 TEST_F(ScreenTest, GetNumDisplays) {
50 EXPECT_EQ(Screen::GetScreen()->GetNumDisplays(), 1); 49 EXPECT_EQ(Screen::GetScreen()->GetNumDisplays(), 1);
51 } 50 }
52 51
53 TEST_F(ScreenTest, GetDisplayWithDisplayId) { 52 TEST_F(ScreenTest, GetDisplayWithDisplayId) {
54 Display display; 53 Display display;
55 EXPECT_TRUE(Screen::GetScreen()->GetDisplayWithDisplayId(DEFAULT_DISPLAY_ID, 54 EXPECT_TRUE(Screen::GetScreen()->GetDisplayWithDisplayId(DEFAULT_DISPLAY_ID,
56 &display)); 55 &display));
57 EXPECT_EQ(DEFAULT_DISPLAY_ID, display.id()); 56 EXPECT_EQ(DEFAULT_DISPLAY_ID, display.id());
58 EXPECT_EQ(DEFAULT_DISPLAY_WIDTH, display.size().width()); 57 EXPECT_EQ(DEFAULT_DISPLAY_WIDTH, display.size().width());
59 EXPECT_EQ(DEFAULT_DISPLAY_HEIGHT, display.size().height()); 58 EXPECT_EQ(DEFAULT_DISPLAY_HEIGHT, display.size().height());
60 } 59 }
61 60
62 } // namespace 61 } // namespace display
OLDNEW
« no previous file with comments | « ui/display/screen.cc ('k') | ui/display/test/display_manager_test_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698