OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/test/chromedriver/chrome/mobile_device.h" |
| 6 |
| 7 #include <utility> |
| 8 |
5 #include "base/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
6 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
7 #include "base/strings/string_split.h" | 11 #include "base/strings/string_split.h" |
8 #include "base/values.h" | 12 #include "base/values.h" |
9 #include "chrome/test/chromedriver/chrome/mobile_device.h" | |
10 #include "chrome/test/chromedriver/chrome/mobile_device_list.h" | 13 #include "chrome/test/chromedriver/chrome/mobile_device_list.h" |
11 #include "chrome/test/chromedriver/chrome/status.h" | 14 #include "chrome/test/chromedriver/chrome/status.h" |
12 | 15 |
13 MobileDevice::MobileDevice() {} | 16 MobileDevice::MobileDevice() {} |
14 MobileDevice::~MobileDevice() {} | 17 MobileDevice::~MobileDevice() {} |
15 | 18 |
16 Status FindMobileDevice(std::string device_name, | 19 Status FindMobileDevice(std::string device_name, |
17 scoped_ptr<MobileDevice>* mobile_device) { | 20 scoped_ptr<MobileDevice>* mobile_device) { |
18 base::JSONReader json_reader(base::JSON_ALLOW_TRAILING_COMMAS); | 21 base::JSONReader json_reader(base::JSON_ALLOW_TRAILING_COMMAS); |
19 scoped_ptr<base::Value> devices_value = | 22 scoped_ptr<base::Value> devices_value = |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 return Status(kUnknownError, | 61 return Status(kUnknownError, |
59 "malformed touch: should be a bool"); | 62 "malformed touch: should be a bool"); |
60 } | 63 } |
61 if (!device->GetBoolean("mobile", &mobile)) { | 64 if (!device->GetBoolean("mobile", &mobile)) { |
62 return Status(kUnknownError, | 65 return Status(kUnknownError, |
63 "malformed mobile: should be a bool"); | 66 "malformed mobile: should be a bool"); |
64 } | 67 } |
65 tmp_mobile_device->device_metrics.reset( | 68 tmp_mobile_device->device_metrics.reset( |
66 new DeviceMetrics(width, height, device_scale_factor, touch, mobile)); | 69 new DeviceMetrics(width, height, device_scale_factor, touch, mobile)); |
67 | 70 |
68 *mobile_device = tmp_mobile_device.Pass(); | 71 *mobile_device = std::move(tmp_mobile_device); |
69 return Status(kOk); | 72 return Status(kOk); |
70 | 73 |
71 } | 74 } |
OLD | NEW |