OLD | NEW |
---|---|
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 "chrome/browser/extensions/api/system_display/system_display_api.h" | 5 #include "chrome/browser/extensions/api/system_display/system_display_api.h" |
6 | 6 |
7 #include "base/debug/leak_annotations.h" | 7 #include "base/debug/leak_annotations.h" |
8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
9 #include "chrome/browser/extensions/api/system_display/display_info_provider.h" | 9 #include "chrome/browser/extensions/api/system_display/display_info_provider.h" |
10 #include "chrome/browser/extensions/extension_apitest.h" | 10 #include "chrome/browser/extensions/extension_apitest.h" |
11 #include "chrome/browser/extensions/extension_function_test_utils.h" | 11 #include "chrome/browser/extensions/extension_function_test_utils.h" |
12 #include "ui/gfx/display.h" | 12 #include "ui/gfx/display.h" |
13 #include "ui/gfx/display_observer.h" | 13 #include "ui/gfx/display_observer.h" |
14 #include "ui/gfx/screen.h" | 14 #include "ui/gfx/screen.h" |
15 | 15 |
16 #if defined(OS_CHROMEOS) | 16 #if defined(OS_CHROMEOS) |
17 #include "ash/screen_ash.h" | 17 #include "ash/display/screen_ash.h" |
18 #include "ash/shell.h" | 18 #include "ash/shell.h" |
19 #endif | 19 #endif |
20 | 20 |
21 namespace utils = extension_function_test_utils; | 21 namespace utils = extension_function_test_utils; |
22 | 22 |
23 namespace extensions { | 23 namespace extensions { |
24 | 24 |
25 using api::system_display::Bounds; | 25 using api::system_display::Bounds; |
26 using api::system_display::DisplayUnitInfo; | 26 using api::system_display::DisplayUnitInfo; |
27 using gfx::Screen; | 27 using gfx::Screen; |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
178 ExtensionApiTest::SetUpOnMainThread(); | 178 ExtensionApiTest::SetUpOnMainThread(); |
179 ANNOTATE_LEAKING_OBJECT_PTR( | 179 ANNOTATE_LEAKING_OBJECT_PTR( |
180 gfx::Screen::GetScreenByType(gfx::SCREEN_TYPE_NATIVE)); | 180 gfx::Screen::GetScreenByType(gfx::SCREEN_TYPE_NATIVE)); |
181 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, screen_.get()); | 181 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, screen_.get()); |
182 DisplayInfoProvider::InitializeForTesting(provider_.get()); | 182 DisplayInfoProvider::InitializeForTesting(provider_.get()); |
183 } | 183 } |
184 | 184 |
185 virtual void CleanUpOnMainThread() OVERRIDE { | 185 virtual void CleanUpOnMainThread() OVERRIDE { |
186 #if defined(OS_CHROMEOS) | 186 #if defined(OS_CHROMEOS) |
187 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, | 187 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, |
188 ash::Shell::GetInstance()->screen()); | 188 ash::Shell::GetScreen()); |
Jun Mukai
2014/01/15 19:20:15
Doesn't it fit into the previous line?
oshima
2014/01/15 19:42:51
nope (85 chars)
| |
189 #endif | 189 #endif |
190 ExtensionApiTest::CleanUpOnMainThread(); | 190 ExtensionApiTest::CleanUpOnMainThread(); |
191 } | 191 } |
192 | 192 |
193 protected: | 193 protected: |
194 scoped_ptr<MockDisplayInfoProvider> provider_; | 194 scoped_ptr<MockDisplayInfoProvider> provider_; |
195 scoped_ptr<gfx::Screen> screen_; | 195 scoped_ptr<gfx::Screen> screen_; |
196 | 196 |
197 DISALLOW_COPY_AND_ASSIGN(SystemDisplayApiTest); | 197 DISALLOW_COPY_AND_ASSIGN(SystemDisplayApiTest); |
198 }; | 198 }; |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
295 EXPECT_EQ(1, utils::GetInteger(overscan, "left")); | 295 EXPECT_EQ(1, utils::GetInteger(overscan, "left")); |
296 EXPECT_EQ(2, utils::GetInteger(overscan, "top")); | 296 EXPECT_EQ(2, utils::GetInteger(overscan, "top")); |
297 EXPECT_EQ(3, utils::GetInteger(overscan, "right")); | 297 EXPECT_EQ(3, utils::GetInteger(overscan, "right")); |
298 EXPECT_EQ(4, utils::GetInteger(overscan, "bottom")); | 298 EXPECT_EQ(4, utils::GetInteger(overscan, "bottom")); |
299 | 299 |
300 EXPECT_EQ("display_id", provider_->GetSetInfoDisplayId()); | 300 EXPECT_EQ("display_id", provider_->GetSetInfoDisplayId()); |
301 } | 301 } |
302 #endif // defined(OS_CHROMEOS) | 302 #endif // defined(OS_CHROMEOS) |
303 | 303 |
304 } // namespace extensions | 304 } // namespace extensions |
OLD | NEW |