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

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

Issue 16687002: Add additional properties to display system info on ChromeOS (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years, 6 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 "base/strings/string_number_conversions.h"
6 #include "chrome/browser/extensions/api/system_info_display/display_info_provide r.h" 7 #include "chrome/browser/extensions/api/system_info_display/display_info_provide r.h"
7 #include "chrome/browser/extensions/extension_apitest.h" 8 #include "chrome/browser/extensions/extension_apitest.h"
8 #include "chrome/browser/extensions/extension_test_message_listener.h" 9 #include "chrome/browser/extensions/extension_test_message_listener.h"
9 #include "chrome/common/chrome_switches.h" 10 #include "chrome/common/chrome_switches.h"
10 11
11 namespace extensions { 12 namespace extensions {
12 13
13 using api::system_info_display::Bounds; 14 using api::system_info_display::Bounds;
14 using api::system_info_display::DisplayUnitInfo; 15 using api::system_info_display::DisplayUnitInfo;
15 16
16 class MockDisplayInfoProvider : public DisplayInfoProvider { 17 class MockDisplayInfoProvider : public DisplayInfoProvider {
17 public: 18 public:
18 virtual bool QueryInfo(DisplayInfo* info) OVERRIDE { 19 virtual bool QueryInfo(DisplayInfo* info) OVERRIDE {
19 info->clear(); 20 info->clear();
20 for (int i = 0; i < 2; i++) { 21 for (int i = 0; i < 4; i++) {
21 linked_ptr<DisplayUnitInfo> unit(new DisplayUnitInfo()); 22 linked_ptr<DisplayUnitInfo> unit(new DisplayUnitInfo());
22 unit->id = "DISPLAY"; 23 unit->id = base::IntToString(i);
23 unit->name = "DISPLAY NAME"; 24 unit->name = "DISPLAY NAME FOR " + unit->id;
25 if (i == 1)
26 unit->mirroring_source_id = "0";
24 unit->is_primary = i == 0 ? true : false; 27 unit->is_primary = i == 0 ? true : false;
25 unit->is_internal = i == 0 ? true : false; 28 unit->is_internal = i == 0 ? true : false;
26 unit->is_enabled = true; 29 unit->is_enabled = true;
30 unit->rotation = (90 * i) % 360;
27 unit->dpi_x = 96.0; 31 unit->dpi_x = 96.0;
28 unit->dpi_y = 96.0; 32 unit->dpi_y = 96.0;
29 unit->bounds.left = 0; 33 unit->bounds.left = 0;
30 unit->bounds.top = 0; 34 unit->bounds.top = 0;
31 unit->bounds.width = 1280; 35 unit->bounds.width = 1280;
32 unit->bounds.height = 720; 36 unit->bounds.height = 720;
37 if (i == 0) {
38 unit->overscan.left = 20;
39 unit->overscan.top = 40;
40 unit->overscan.right = 60;
41 unit->overscan.bottom = 80;
42 }
33 unit->work_area.left = 0; 43 unit->work_area.left = 0;
34 unit->work_area.top = 0; 44 unit->work_area.top = 0;
35 unit->work_area.width = 960; 45 unit->work_area.width = 960;
36 unit->work_area.height = 720; 46 unit->work_area.height = 720;
37 info->push_back(unit); 47 info->push_back(unit);
38 } 48 }
39 return true; 49 return true;
40 } 50 }
41 private: 51 private:
42 virtual ~MockDisplayInfoProvider() {} 52 virtual ~MockDisplayInfoProvider() {}
(...skipping 21 matching lines...) Expand all
64 74
65 IN_PROC_BROWSER_TEST_F(SystemInfoDisplayApiTest, Display) { 75 IN_PROC_BROWSER_TEST_F(SystemInfoDisplayApiTest, Display) {
66 // The |provider| will be owned by the singleton instance. 76 // The |provider| will be owned by the singleton instance.
67 scoped_refptr<MockDisplayInfoProvider> provider = 77 scoped_refptr<MockDisplayInfoProvider> provider =
68 new MockDisplayInfoProvider(); 78 new MockDisplayInfoProvider();
69 DisplayInfoProvider::InitializeForTesting(provider); 79 DisplayInfoProvider::InitializeForTesting(provider);
70 ASSERT_TRUE(RunPlatformAppTest("systeminfo/display")) << message_; 80 ASSERT_TRUE(RunPlatformAppTest("systeminfo/display")) << message_;
71 } 81 }
72 82
73 } // namespace extensions 83 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698