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 "extensions/shell/browser/shell_screen.h" | 5 #include "extensions/shell/browser/shell_screen.h" |
6 | 6 |
7 #include "base/memory/scoped_ptr.h" | 7 #include <memory> |
| 8 |
8 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
9 #include "ui/aura/test/aura_test_base.h" | 10 #include "ui/aura/test/aura_test_base.h" |
10 #include "ui/aura/window.h" | 11 #include "ui/aura/window.h" |
11 #include "ui/aura/window_tree_host.h" | 12 #include "ui/aura/window_tree_host.h" |
12 #include "ui/gfx/display.h" | 13 #include "ui/gfx/display.h" |
13 #include "ui/gfx/geometry/rect.h" | 14 #include "ui/gfx/geometry/rect.h" |
14 #include "ui/gfx/geometry/size.h" | 15 #include "ui/gfx/geometry/size.h" |
15 | 16 |
16 namespace extensions { | 17 namespace extensions { |
17 | 18 |
18 using ShellScreenTest = aura::test::AuraTestBase; | 19 using ShellScreenTest = aura::test::AuraTestBase; |
19 | 20 |
20 // Basic sanity tests for ShellScreen. | 21 // Basic sanity tests for ShellScreen. |
21 TEST_F(ShellScreenTest, ShellScreen) { | 22 TEST_F(ShellScreenTest, ShellScreen) { |
22 ShellScreen screen(gfx::Size(640, 480)); | 23 ShellScreen screen(gfx::Size(640, 480)); |
23 | 24 |
24 // There is only one display. | 25 // There is only one display. |
25 EXPECT_EQ(1, screen.GetNumDisplays()); | 26 EXPECT_EQ(1, screen.GetNumDisplays()); |
26 EXPECT_EQ(1u, screen.GetAllDisplays().size()); | 27 EXPECT_EQ(1u, screen.GetAllDisplays().size()); |
27 EXPECT_EQ(0, screen.GetAllDisplays()[0].id()); | 28 EXPECT_EQ(0, screen.GetAllDisplays()[0].id()); |
28 EXPECT_EQ(0, screen.GetPrimaryDisplay().id()); | 29 EXPECT_EQ(0, screen.GetPrimaryDisplay().id()); |
29 EXPECT_EQ("640x480", screen.GetPrimaryDisplay().size().ToString()); | 30 EXPECT_EQ("640x480", screen.GetPrimaryDisplay().size().ToString()); |
30 | 31 |
31 // Tests that reshaping the host window reshapes the display. | 32 // Tests that reshaping the host window reshapes the display. |
32 // NOTE: AuraTestBase already has its own WindowTreeHost. This is creating a | 33 // NOTE: AuraTestBase already has its own WindowTreeHost. This is creating a |
33 // second one. | 34 // second one. |
34 scoped_ptr<aura::WindowTreeHost> host(screen.CreateHostForPrimaryDisplay()); | 35 std::unique_ptr<aura::WindowTreeHost> host( |
| 36 screen.CreateHostForPrimaryDisplay()); |
35 EXPECT_TRUE(host->window()); | 37 EXPECT_TRUE(host->window()); |
36 host->window()->SetBounds(gfx::Rect(0, 0, 800, 600)); | 38 host->window()->SetBounds(gfx::Rect(0, 0, 800, 600)); |
37 EXPECT_EQ("800x600", screen.GetPrimaryDisplay().size().ToString()); | 39 EXPECT_EQ("800x600", screen.GetPrimaryDisplay().size().ToString()); |
38 } | 40 } |
39 | 41 |
40 } // namespace extensions | 42 } // namespace extensions |
OLD | NEW |