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/projecting_observer_chromeos.h" | 5 #include "ash/display/projecting_observer_chromeos.h" |
6 | 6 |
7 #include "base/memory/scoped_vector.h" | 7 #include "base/memory/scoped_vector.h" |
8 #include "chromeos/dbus/fake_power_manager_client.h" | 8 #include "chromeos/dbus/fake_power_manager_client.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 #include "ui/display/chromeos/test/test_display_snapshot.h" | 10 #include "ui/display/fake_display_snapshot.h" |
11 | 11 |
12 namespace ash { | 12 namespace ash { |
13 namespace { | 13 namespace { |
14 | 14 |
15 ui::TestDisplaySnapshot* CreateInternalSnapshot() { | 15 std::unique_ptr<ui::DisplaySnapshot> CreateInternalSnapshot() { |
16 ui::TestDisplaySnapshot* output = new ui::TestDisplaySnapshot(); | 16 return display::FakeDisplaySnapshot::Builder() |
17 output->set_type(ui::DISPLAY_CONNECTION_TYPE_INTERNAL); | 17 .SetId(123) |
18 return output; | 18 .SetNativeMode(gfx::Size(1024, 768)) |
| 19 .SetType(ui::DISPLAY_CONNECTION_TYPE_INTERNAL) |
| 20 .Build(); |
19 } | 21 } |
20 | 22 |
21 ui::TestDisplaySnapshot* CreateVGASnapshot() { | 23 std::unique_ptr<ui::DisplaySnapshot> CreateVGASnapshot() { |
22 ui::TestDisplaySnapshot* output = new ui::TestDisplaySnapshot(); | 24 return display::FakeDisplaySnapshot::Builder() |
23 output->set_type(ui::DISPLAY_CONNECTION_TYPE_VGA); | 25 .SetId(456) |
24 return output; | 26 .SetNativeMode(gfx::Size(1024, 768)) |
| 27 .SetType(ui::DISPLAY_CONNECTION_TYPE_VGA) |
| 28 .Build(); |
25 } | 29 } |
26 | 30 |
27 class ProjectingObserverTest : public testing::Test { | 31 class ProjectingObserverTest : public testing::Test { |
28 public: | 32 public: |
29 ProjectingObserverTest() : observer_(&fake_power_client_) {} | 33 ProjectingObserverTest() : observer_(&fake_power_client_) {} |
30 | 34 |
31 ~ProjectingObserverTest() override {} | 35 ~ProjectingObserverTest() override {} |
32 | 36 |
33 protected: | 37 protected: |
34 chromeos::FakePowerManagerClient fake_power_client_; | 38 chromeos::FakePowerManagerClient fake_power_client_; |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 | 153 |
150 // Remove VGA output. | 154 // Remove VGA output. |
151 displays.erase(displays.begin() + 1); | 155 displays.erase(displays.begin() + 1); |
152 observer_.OnDisplayModeChanged(displays.get()); | 156 observer_.OnDisplayModeChanged(displays.get()); |
153 | 157 |
154 EXPECT_EQ(2, fake_power_client_.num_set_is_projecting_calls()); | 158 EXPECT_EQ(2, fake_power_client_.num_set_is_projecting_calls()); |
155 EXPECT_FALSE(fake_power_client_.is_projecting()); | 159 EXPECT_FALSE(fake_power_client_.is_projecting()); |
156 } | 160 } |
157 | 161 |
158 } // namespace ash | 162 } // namespace ash |
OLD | NEW |