| 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 <memory> | 5 #include <memory> |
| 6 #include <string> | 6 #include <string> |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "chrome/browser/extensions/extension_apitest.h" | 10 #include "chrome/browser/extensions/extension_apitest.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 using testing::_; | 24 using testing::_; |
| 25 using testing::Return; | 25 using testing::Return; |
| 26 | 26 |
| 27 namespace extensions { | 27 namespace extensions { |
| 28 namespace { | 28 namespace { |
| 29 | 29 |
| 30 class FakeSerialGetDevicesFunction : public AsyncExtensionFunction { | 30 class FakeSerialGetDevicesFunction : public AsyncExtensionFunction { |
| 31 public: | 31 public: |
| 32 bool RunAsync() override { | 32 bool RunAsync() override { |
| 33 std::unique_ptr<base::ListValue> devices(new base::ListValue()); | 33 std::unique_ptr<base::ListValue> devices(new base::ListValue()); |
| 34 base::DictionaryValue* device0 = new base::DictionaryValue(); | 34 std::unique_ptr<base::DictionaryValue> device0(new base::DictionaryValue()); |
| 35 device0->SetString("path", "/dev/fakeserial"); | 35 device0->SetString("path", "/dev/fakeserial"); |
| 36 base::DictionaryValue* device1 = new base::DictionaryValue(); | 36 std::unique_ptr<base::DictionaryValue> device1(new base::DictionaryValue()); |
| 37 device1->SetString("path", "\\\\COM800\\"); | 37 device1->SetString("path", "\\\\COM800\\"); |
| 38 devices->Append(device0); | 38 devices->Append(std::move(device0)); |
| 39 devices->Append(device1); | 39 devices->Append(std::move(device1)); |
| 40 SetResult(std::move(devices)); | 40 SetResult(std::move(devices)); |
| 41 SendResponse(true); | 41 SendResponse(true); |
| 42 return true; | 42 return true; |
| 43 } | 43 } |
| 44 | 44 |
| 45 protected: | 45 protected: |
| 46 ~FakeSerialGetDevicesFunction() override {} | 46 ~FakeSerialGetDevicesFunction() override {} |
| 47 }; | 47 }; |
| 48 | 48 |
| 49 class FakeSerialDeviceEnumerator : public device::SerialDeviceEnumerator { | 49 class FakeSerialDeviceEnumerator : public device::SerialDeviceEnumerator { |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 IN_PROC_BROWSER_TEST_P(SerialApiTest, SerialRealHardware) { | 197 IN_PROC_BROWSER_TEST_P(SerialApiTest, SerialRealHardware) { |
| 198 ResultCatcher catcher; | 198 ResultCatcher catcher; |
| 199 catcher.RestrictToBrowserContext(browser()->profile()); | 199 catcher.RestrictToBrowserContext(browser()->profile()); |
| 200 | 200 |
| 201 ASSERT_TRUE(RunExtensionTest("serial/real_hardware")) << message_; | 201 ASSERT_TRUE(RunExtensionTest("serial/real_hardware")) << message_; |
| 202 } | 202 } |
| 203 | 203 |
| 204 INSTANTIATE_TEST_CASE_P(SerialApiTest, SerialApiTest, testing::Bool()); | 204 INSTANTIATE_TEST_CASE_P(SerialApiTest, SerialApiTest, testing::Bool()); |
| 205 | 205 |
| 206 } // namespace extensions | 206 } // namespace extensions |
| OLD | NEW |