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

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

Issue 18290002: [SystemInfo API] Finish TODOs in SystemInfoProvider (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@dev_rewrite_storage_info_api
Patch Set: Pass chromeos unit_tests Created 7 years, 5 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 (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 4
5 #include "chrome/browser/extensions/api/system_info_display/system_info_display_ api.h" 5 #include "chrome/browser/extensions/api/system_info_display/system_info_display_ api.h"
6 6
7 #include "base/strings/string_number_conversions.h" 7 #include "base/strings/string_number_conversions.h"
8 #include "chrome/browser/extensions/api/system_info_display/display_info_provide r.h" 8 #include "chrome/browser/extensions/api/system_info_display/display_info_provide r.h"
9 #include "chrome/browser/extensions/extension_apitest.h" 9 #include "chrome/browser/extensions/extension_apitest.h"
10 #include "chrome/browser/extensions/extension_function_test_utils.h" 10 #include "chrome/browser/extensions/extension_function_test_utils.h"
11 11
12 namespace utils = extension_function_test_utils; 12 namespace utils = extension_function_test_utils;
13 13
14 namespace extensions { 14 namespace extensions {
15 15
16 using api::system_info_display::Bounds; 16 using api::system_info_display::Bounds;
17 using api::system_info_display::DisplayUnitInfo; 17 using api::system_info_display::DisplayUnitInfo;
18 18
19 class MockDisplayInfoProvider : public DisplayInfoProvider { 19 class MockDisplayInfoProvider : public DisplayInfoProvider {
20 public: 20 public:
21 MockDisplayInfoProvider() {} 21 MockDisplayInfoProvider() {}
22 22
23 virtual bool QueryInfo(DisplayInfo* info) OVERRIDE { 23 virtual bool QueryInfo() OVERRIDE {
24 info->clear(); 24 info_.clear();
25 for (int i = 0; i < 4; i++) { 25 for (int i = 0; i < 4; i++) {
26 linked_ptr<DisplayUnitInfo> unit(new DisplayUnitInfo()); 26 linked_ptr<DisplayUnitInfo> unit(new DisplayUnitInfo());
27 unit->id = base::IntToString(i); 27 unit->id = base::IntToString(i);
28 unit->name = "DISPLAY NAME FOR " + unit->id; 28 unit->name = "DISPLAY NAME FOR " + unit->id;
29 if (i == 1) 29 if (i == 1)
30 unit->mirroring_source_id = "0"; 30 unit->mirroring_source_id = "0";
31 unit->is_primary = i == 0 ? true : false; 31 unit->is_primary = i == 0 ? true : false;
32 unit->is_internal = i == 0 ? true : false; 32 unit->is_internal = i == 0 ? true : false;
33 unit->is_enabled = true; 33 unit->is_enabled = true;
34 unit->rotation = (90 * i) % 360; 34 unit->rotation = (90 * i) % 360;
35 unit->dpi_x = 96.0; 35 unit->dpi_x = 96.0;
36 unit->dpi_y = 96.0; 36 unit->dpi_y = 96.0;
37 unit->bounds.left = 0; 37 unit->bounds.left = 0;
38 unit->bounds.top = 0; 38 unit->bounds.top = 0;
39 unit->bounds.width = 1280; 39 unit->bounds.width = 1280;
40 unit->bounds.height = 720; 40 unit->bounds.height = 720;
41 if (i == 0) { 41 if (i == 0) {
42 unit->overscan.left = 20; 42 unit->overscan.left = 20;
43 unit->overscan.top = 40; 43 unit->overscan.top = 40;
44 unit->overscan.right = 60; 44 unit->overscan.right = 60;
45 unit->overscan.bottom = 80; 45 unit->overscan.bottom = 80;
46 } 46 }
47 unit->work_area.left = 0; 47 unit->work_area.left = 0;
48 unit->work_area.top = 0; 48 unit->work_area.top = 0;
49 unit->work_area.width = 960; 49 unit->work_area.width = 960;
50 unit->work_area.height = 720; 50 unit->work_area.height = 720;
51 info->push_back(unit); 51 info_.push_back(unit);
52 } 52 }
53 return true; 53 return true;
54 } 54 }
55 55
56 virtual void SetInfo( 56 virtual void SetInfo(
57 const std::string& display_id, 57 const std::string& display_id,
58 const api::system_info_display::DisplayProperties& params, 58 const api::system_info_display::DisplayProperties& params,
59 const SetInfoCallback& callback) OVERRIDE { 59 const SetInfoCallback& callback) OVERRIDE {
60 // Should get called only once per test case. 60 // Should get called only once per test case.
61 EXPECT_FALSE(set_info_value_); 61 EXPECT_FALSE(set_info_value_);
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 EXPECT_EQ(1, utils::GetInteger(overscan, "left")); 203 EXPECT_EQ(1, utils::GetInteger(overscan, "left"));
204 EXPECT_EQ(2, utils::GetInteger(overscan, "top")); 204 EXPECT_EQ(2, utils::GetInteger(overscan, "top"));
205 EXPECT_EQ(3, utils::GetInteger(overscan, "right")); 205 EXPECT_EQ(3, utils::GetInteger(overscan, "right"));
206 EXPECT_EQ(4, utils::GetInteger(overscan, "bottom")); 206 EXPECT_EQ(4, utils::GetInteger(overscan, "bottom"));
207 207
208 EXPECT_EQ("display_id", provider_->GetSetInfoDisplayId()); 208 EXPECT_EQ("display_id", provider_->GetSetInfoDisplayId());
209 } 209 }
210 #endif // defined(OS_CHROMEOS) 210 #endif // defined(OS_CHROMEOS)
211 211
212 } // namespace extensions 212 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698