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

Side by Side Diff: chrome/browser/extensions/api/system_info_display/system_info_display_apitest.cc

Issue 11882009: Multi-monitor extension API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase to 179043. Created 7 years, 10 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include "base/command_line.h" 4 #include "base/command_line.h"
5 #include "base/message_loop.h" 5 #include "base/message_loop.h"
6 #include "chrome/browser/extensions/api/system_info_display/display_info_provide r.h" 6 #include "chrome/browser/extensions/api/system_info_display/display_info_provide r.h"
7 #include "chrome/browser/extensions/extension_apitest.h" 7 #include "chrome/browser/extensions/extension_apitest.h"
8 #include "chrome/browser/extensions/extension_test_message_listener.h" 8 #include "chrome/browser/extensions/extension_test_message_listener.h"
9 #include "chrome/common/chrome_switches.h" 9 #include "chrome/common/chrome_switches.h"
10 10
11 namespace extensions { 11 namespace extensions {
12 12
13 using api::experimental_system_info_display::DisplayUnitInfo; 13 using api::system_info_display::Bounds;
14 using api::system_info_display::DisplayUnitInfo;
14 15
15 class MockDisplayInfoProvider : public DisplayInfoProvider { 16 class MockDisplayInfoProvider : public DisplayInfoProvider {
16 public: 17 public:
17 virtual bool QueryInfo(DisplayInfo* info) OVERRIDE { 18 virtual bool QueryInfo(DisplayInfo* info) OVERRIDE {
18 info->clear(); 19 info->clear();
19 for (int i = 0; i < 2; i++) { 20 for (int i = 0; i < 2; i++) {
20 linked_ptr<DisplayUnitInfo> unit(new DisplayUnitInfo()); 21 linked_ptr<DisplayUnitInfo> unit(new DisplayUnitInfo());
21 unit->id = "DISPLAY"; 22 unit->id = "DISPLAY";
22 unit->index = i; 23 unit->name = "DISPLAY NAME";
23 unit->is_primary = i == 0 ? true : false; 24 unit->is_primary = i == 0 ? true : false;
24 unit->avail_top = 0; 25 unit->is_internal = i == 0 ? true : false;
25 unit->avail_left = 0; 26 unit->is_enabled = true;
26 unit->avail_width = 960; 27 unit->dpi_x = 96.0;
27 unit->avail_height = 720; 28 unit->dpi_y = 96.0;
28 unit->color_depth = 32; 29 unit->bounds.left = 0;
29 unit->pixel_depth = 32; 30 unit->bounds.top = 0;
30 unit->height = 1280; 31 unit->bounds.width = 1280;
31 unit->width = 720; 32 unit->bounds.height = 720;
32 unit->absolute_top_offset = 0; 33 unit->work_area.left = 0;
33 unit->absolute_left_offset = 1280; 34 unit->work_area.top = 0;
34 unit->dpi_x = 96; 35 unit->work_area.width = 960;
35 unit->dpi_y = 96; 36 unit->work_area.height = 720;
36 info->push_back(unit); 37 info->push_back(unit);
37 } 38 }
38 return true; 39 return true;
39 } 40 }
40 private: 41 private:
41 virtual ~MockDisplayInfoProvider() {} 42 virtual ~MockDisplayInfoProvider() {}
42 43
43 }; 44 };
44 45
45 class SystemInfoDisplayApiTest: public ExtensionApiTest { 46 class SystemInfoDisplayApiTest: public ExtensionApiTest {
(...skipping 17 matching lines...) Expand all
63 64
64 IN_PROC_BROWSER_TEST_F(SystemInfoDisplayApiTest, Display) { 65 IN_PROC_BROWSER_TEST_F(SystemInfoDisplayApiTest, Display) {
65 // The |provider| will be owned by the singleton instance. 66 // The |provider| will be owned by the singleton instance.
66 scoped_refptr<MockDisplayInfoProvider> provider = 67 scoped_refptr<MockDisplayInfoProvider> provider =
67 new MockDisplayInfoProvider(); 68 new MockDisplayInfoProvider();
68 DisplayInfoProvider::InitializeForTesting(provider); 69 DisplayInfoProvider::InitializeForTesting(provider);
69 ASSERT_TRUE(RunPlatformAppTest("systeminfo/display")) << message_; 70 ASSERT_TRUE(RunPlatformAppTest("systeminfo/display")) << message_;
70 } 71 }
71 72
72 } // namespace extensions 73 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698