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

Side by Side Diff: chrome/browser/extensions/api/system_display/system_display_apitest.cc

Issue 624153002: replace OVERRIDE and FINAL with override and final in chrome/browser/extensions/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "base/debug/leak_annotations.h" 5 #include "base/debug/leak_annotations.h"
6 #include "base/strings/string_number_conversions.h" 6 #include "base/strings/string_number_conversions.h"
7 #include "chrome/browser/extensions/extension_apitest.h" 7 #include "chrome/browser/extensions/extension_apitest.h"
8 #include "chrome/browser/extensions/extension_function_test_utils.h" 8 #include "chrome/browser/extensions/extension_function_test_utils.h"
9 #include "extensions/browser/api/system_display/display_info_provider.h" 9 #include "extensions/browser/api/system_display/display_info_provider.h"
10 #include "extensions/browser/api/system_display/system_display_api.h" 10 #include "extensions/browser/api/system_display/system_display_api.h"
(...skipping 24 matching lines...) Expand all
35 gfx::Rect work_area(0, 0, 960, 720); 35 gfx::Rect work_area(0, 0, 960, 720);
36 gfx::Display display(i, bounds); 36 gfx::Display display(i, bounds);
37 display.set_work_area(work_area); 37 display.set_work_area(work_area);
38 displays_.push_back(display); 38 displays_.push_back(display);
39 } 39 }
40 } 40 }
41 virtual ~MockScreen() {} 41 virtual ~MockScreen() {}
42 42
43 protected: 43 protected:
44 // Overridden from gfx::Screen: 44 // Overridden from gfx::Screen:
45 virtual int GetNumDisplays() const OVERRIDE { 45 virtual int GetNumDisplays() const override {
46 return displays_.size(); 46 return displays_.size();
47 } 47 }
48 virtual std::vector<gfx::Display> GetAllDisplays() const OVERRIDE { 48 virtual std::vector<gfx::Display> GetAllDisplays() const override {
49 return displays_; 49 return displays_;
50 } 50 }
51 virtual gfx::Display GetPrimaryDisplay() const OVERRIDE { 51 virtual gfx::Display GetPrimaryDisplay() const override {
52 return displays_[0]; 52 return displays_[0];
53 } 53 }
54 54
55 private: 55 private:
56 std::vector<gfx::Display> displays_; 56 std::vector<gfx::Display> displays_;
57 57
58 DISALLOW_COPY_AND_ASSIGN(MockScreen); 58 DISALLOW_COPY_AND_ASSIGN(MockScreen);
59 }; 59 };
60 #else 60 #else
61 class MockScreen : public Screen { 61 class MockScreen : public Screen {
62 public: 62 public:
63 MockScreen() { 63 MockScreen() {
64 for (int i = 0; i < 4; i++) { 64 for (int i = 0; i < 4; i++) {
65 gfx::Rect bounds(0, 0, 1280, 720); 65 gfx::Rect bounds(0, 0, 1280, 720);
66 gfx::Rect work_area(0, 0, 960, 720); 66 gfx::Rect work_area(0, 0, 960, 720);
67 gfx::Display display(i, bounds); 67 gfx::Display display(i, bounds);
68 display.set_work_area(work_area); 68 display.set_work_area(work_area);
69 displays_.push_back(display); 69 displays_.push_back(display);
70 } 70 }
71 } 71 }
72 virtual ~MockScreen() {} 72 virtual ~MockScreen() {}
73 73
74 protected: 74 protected:
75 // Overridden from gfx::Screen: 75 // Overridden from gfx::Screen:
76 virtual bool IsDIPEnabled() OVERRIDE { return true; } 76 virtual bool IsDIPEnabled() override { return true; }
77 virtual gfx::Point GetCursorScreenPoint() OVERRIDE { return gfx::Point(); } 77 virtual gfx::Point GetCursorScreenPoint() override { return gfx::Point(); }
78 virtual gfx::NativeWindow GetWindowUnderCursor() OVERRIDE { 78 virtual gfx::NativeWindow GetWindowUnderCursor() override {
79 return gfx::NativeWindow(); 79 return gfx::NativeWindow();
80 } 80 }
81 virtual gfx::NativeWindow GetWindowAtScreenPoint( 81 virtual gfx::NativeWindow GetWindowAtScreenPoint(
82 const gfx::Point& point) OVERRIDE { 82 const gfx::Point& point) override {
83 return gfx::NativeWindow(); 83 return gfx::NativeWindow();
84 } 84 }
85 virtual int GetNumDisplays() const OVERRIDE { 85 virtual int GetNumDisplays() const override {
86 return displays_.size(); 86 return displays_.size();
87 } 87 }
88 virtual std::vector<gfx::Display> GetAllDisplays() const OVERRIDE { 88 virtual std::vector<gfx::Display> GetAllDisplays() const override {
89 return displays_; 89 return displays_;
90 } 90 }
91 virtual gfx::Display GetDisplayNearestWindow( 91 virtual gfx::Display GetDisplayNearestWindow(
92 gfx::NativeView window) const OVERRIDE { 92 gfx::NativeView window) const override {
93 return gfx::Display(0); 93 return gfx::Display(0);
94 } 94 }
95 virtual gfx::Display GetDisplayNearestPoint( 95 virtual gfx::Display GetDisplayNearestPoint(
96 const gfx::Point& point) const OVERRIDE { 96 const gfx::Point& point) const override {
97 return gfx::Display(0); 97 return gfx::Display(0);
98 } 98 }
99 virtual gfx::Display GetDisplayMatching( 99 virtual gfx::Display GetDisplayMatching(
100 const gfx::Rect& match_rect) const OVERRIDE { 100 const gfx::Rect& match_rect) const override {
101 return gfx::Display(0); 101 return gfx::Display(0);
102 } 102 }
103 virtual gfx::Display GetPrimaryDisplay() const OVERRIDE { 103 virtual gfx::Display GetPrimaryDisplay() const override {
104 return displays_[0]; 104 return displays_[0];
105 } 105 }
106 virtual void AddObserver(gfx::DisplayObserver* observer) OVERRIDE {} 106 virtual void AddObserver(gfx::DisplayObserver* observer) override {}
107 virtual void RemoveObserver(gfx::DisplayObserver* observer) OVERRIDE {} 107 virtual void RemoveObserver(gfx::DisplayObserver* observer) override {}
108 108
109 private: 109 private:
110 std::vector<gfx::Display> displays_; 110 std::vector<gfx::Display> displays_;
111 111
112 DISALLOW_COPY_AND_ASSIGN(MockScreen); 112 DISALLOW_COPY_AND_ASSIGN(MockScreen);
113 }; 113 };
114 #endif 114 #endif
115 115
116 class MockDisplayInfoProvider : public DisplayInfoProvider { 116 class MockDisplayInfoProvider : public DisplayInfoProvider {
117 public: 117 public:
118 MockDisplayInfoProvider() {} 118 MockDisplayInfoProvider() {}
119 119
120 virtual ~MockDisplayInfoProvider() {} 120 virtual ~MockDisplayInfoProvider() {}
121 121
122 virtual bool SetInfo( 122 virtual bool SetInfo(
123 const std::string& display_id, 123 const std::string& display_id,
124 const core_api::system_display::DisplayProperties& params, 124 const core_api::system_display::DisplayProperties& params,
125 std::string* error) OVERRIDE { 125 std::string* error) override {
126 // Should get called only once per test case. 126 // Should get called only once per test case.
127 EXPECT_FALSE(set_info_value_); 127 EXPECT_FALSE(set_info_value_);
128 set_info_value_ = params.ToValue(); 128 set_info_value_ = params.ToValue();
129 set_info_display_id_ = display_id; 129 set_info_display_id_ = display_id;
130 return true; 130 return true;
131 } 131 }
132 132
133 virtual gfx::Screen* GetActiveScreen() OVERRIDE { return NULL; } 133 virtual gfx::Screen* GetActiveScreen() override { return NULL; }
134 134
135 scoped_ptr<base::DictionaryValue> GetSetInfoValue() { 135 scoped_ptr<base::DictionaryValue> GetSetInfoValue() {
136 return set_info_value_.Pass(); 136 return set_info_value_.Pass();
137 } 137 }
138 138
139 std::string GetSetInfoDisplayId() const { 139 std::string GetSetInfoDisplayId() const {
140 return set_info_display_id_; 140 return set_info_display_id_;
141 } 141 }
142 142
143 private: 143 private:
144 // Update the content of the |unit| obtained for |display| using 144 // Update the content of the |unit| obtained for |display| using
145 // platform specific method. 145 // platform specific method.
146 virtual void UpdateDisplayUnitInfoForPlatform( 146 virtual void UpdateDisplayUnitInfoForPlatform(
147 const gfx::Display& display, 147 const gfx::Display& display,
148 extensions::core_api::system_display::DisplayUnitInfo* unit) OVERRIDE { 148 extensions::core_api::system_display::DisplayUnitInfo* unit) override {
149 int64 id = display.id(); 149 int64 id = display.id();
150 unit->name = "DISPLAY NAME FOR " + base::Int64ToString(id); 150 unit->name = "DISPLAY NAME FOR " + base::Int64ToString(id);
151 if (id == 1) 151 if (id == 1)
152 unit->mirroring_source_id = "0"; 152 unit->mirroring_source_id = "0";
153 unit->is_primary = id == 0 ? true : false; 153 unit->is_primary = id == 0 ? true : false;
154 unit->is_internal = id == 0 ? true : false; 154 unit->is_internal = id == 0 ? true : false;
155 unit->is_enabled = true; 155 unit->is_enabled = true;
156 unit->rotation = (90 * id) % 360; 156 unit->rotation = (90 * id) % 360;
157 unit->dpi_x = 96.0; 157 unit->dpi_x = 96.0;
158 unit->dpi_y = 96.0; 158 unit->dpi_y = 96.0;
(...skipping 11 matching lines...) Expand all
170 DISALLOW_COPY_AND_ASSIGN(MockDisplayInfoProvider); 170 DISALLOW_COPY_AND_ASSIGN(MockDisplayInfoProvider);
171 }; 171 };
172 172
173 class SystemDisplayApiTest: public ExtensionApiTest { 173 class SystemDisplayApiTest: public ExtensionApiTest {
174 public: 174 public:
175 SystemDisplayApiTest() : provider_(new MockDisplayInfoProvider), 175 SystemDisplayApiTest() : provider_(new MockDisplayInfoProvider),
176 screen_(new MockScreen) {} 176 screen_(new MockScreen) {}
177 177
178 virtual ~SystemDisplayApiTest() {} 178 virtual ~SystemDisplayApiTest() {}
179 179
180 virtual void SetUpOnMainThread() OVERRIDE { 180 virtual void SetUpOnMainThread() override {
181 ExtensionApiTest::SetUpOnMainThread(); 181 ExtensionApiTest::SetUpOnMainThread();
182 ANNOTATE_LEAKING_OBJECT_PTR( 182 ANNOTATE_LEAKING_OBJECT_PTR(
183 gfx::Screen::GetScreenByType(gfx::SCREEN_TYPE_NATIVE)); 183 gfx::Screen::GetScreenByType(gfx::SCREEN_TYPE_NATIVE));
184 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, screen_.get()); 184 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, screen_.get());
185 DisplayInfoProvider::InitializeForTesting(provider_.get()); 185 DisplayInfoProvider::InitializeForTesting(provider_.get());
186 } 186 }
187 187
188 virtual void TearDownOnMainThread() OVERRIDE { 188 virtual void TearDownOnMainThread() override {
189 #if defined(OS_CHROMEOS) 189 #if defined(OS_CHROMEOS)
190 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, 190 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE,
191 ash::Shell::GetScreen()); 191 ash::Shell::GetScreen());
192 #endif 192 #endif
193 ExtensionApiTest::TearDownOnMainThread(); 193 ExtensionApiTest::TearDownOnMainThread();
194 } 194 }
195 195
196 protected: 196 protected:
197 scoped_ptr<MockDisplayInfoProvider> provider_; 197 scoped_ptr<MockDisplayInfoProvider> provider_;
198 scoped_ptr<gfx::Screen> screen_; 198 scoped_ptr<gfx::Screen> screen_;
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 EXPECT_EQ(1, utils::GetInteger(overscan, "left")); 299 EXPECT_EQ(1, utils::GetInteger(overscan, "left"));
300 EXPECT_EQ(2, utils::GetInteger(overscan, "top")); 300 EXPECT_EQ(2, utils::GetInteger(overscan, "top"));
301 EXPECT_EQ(3, utils::GetInteger(overscan, "right")); 301 EXPECT_EQ(3, utils::GetInteger(overscan, "right"));
302 EXPECT_EQ(4, utils::GetInteger(overscan, "bottom")); 302 EXPECT_EQ(4, utils::GetInteger(overscan, "bottom"));
303 303
304 EXPECT_EQ("display_id", provider_->GetSetInfoDisplayId()); 304 EXPECT_EQ("display_id", provider_->GetSetInfoDisplayId());
305 } 305 }
306 #endif // defined(OS_CHROMEOS) 306 #endif // defined(OS_CHROMEOS)
307 307
308 } // namespace extensions 308 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698