OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 <memory> | 5 #include <memory> |
6 #include <vector> | 6 #include <vector> |
7 | 7 |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 #include "services/ui/display/platform_screen.h" | 10 #include "services/ui/display/platform_screen.h" |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 std::vector<DisplayState> removed() { return removed_; } | 72 std::vector<DisplayState> removed() { return removed_; } |
73 std::vector<DisplayState> modified() { return modified_; } | 73 std::vector<DisplayState> modified() { return modified_; } |
74 | 74 |
75 void Reset() { | 75 void Reset() { |
76 added_.clear(); | 76 added_.clear(); |
77 removed_.clear(); | 77 removed_.clear(); |
78 modified_.clear(); | 78 modified_.clear(); |
79 } | 79 } |
80 | 80 |
81 private: | 81 private: |
82 void OnDisplayAdded(PlatformScreen* platform_screen, | 82 void OnDisplayAdded(int64_t id, const gfx::Rect& bounds) override { |
83 int64_t id, | |
84 const gfx::Rect& bounds) override { | |
85 added_.push_back({id, bounds}); | 83 added_.push_back({id, bounds}); |
86 } | 84 } |
87 | 85 |
88 void OnDisplayRemoved(int64_t id) override { | 86 void OnDisplayRemoved(int64_t id) override { |
89 removed_.push_back({id, gfx::Rect()}); | 87 removed_.push_back({id, gfx::Rect()}); |
90 } | 88 } |
91 | 89 |
92 void OnDisplayModified(int64_t id, const gfx::Rect& bounds) override { | 90 void OnDisplayModified(int64_t id, const gfx::Rect& bounds) override { |
93 modified_.push_back({id, bounds}); | 91 modified_.push_back({id, bounds}); |
94 } | 92 } |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 // Check that the default display was modified with a new size and display 2 | 312 // Check that the default display was modified with a new size and display 2 |
315 // was modified with a new origin. | 313 // was modified with a new origin. |
316 ASSERT_THAT(delegate()->modified(), SizeIs(2)); | 314 ASSERT_THAT(delegate()->modified(), SizeIs(2)); |
317 EXPECT_THAT(delegate()->modified()[0], DisplayId(kDefaultDisplayId)); | 315 EXPECT_THAT(delegate()->modified()[0], DisplayId(kDefaultDisplayId)); |
318 EXPECT_THAT(delegate()->modified()[0], DisplaySize(size.ToString())); | 316 EXPECT_THAT(delegate()->modified()[0], DisplaySize(size.ToString())); |
319 EXPECT_THAT(delegate()->modified()[1], DisplayId(2)); | 317 EXPECT_THAT(delegate()->modified()[1], DisplayId(2)); |
320 EXPECT_THAT(delegate()->modified()[1], DisplayOrigin("1920,0")); | 318 EXPECT_THAT(delegate()->modified()[1], DisplayOrigin("1920,0")); |
321 } | 319 } |
322 | 320 |
323 } // namespace display | 321 } // namespace display |
OLD | NEW |