| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 <deque> | 5 #include <deque> |
| 6 #include <string> | 6 #include <string> |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "chrome/browser/extensions/api/serial/serial_api.h" | 10 #include "chrome/browser/extensions/api/serial/serial_api.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 public: | 29 public: |
| 30 SerialApiTest() {} | 30 SerialApiTest() {} |
| 31 }; | 31 }; |
| 32 | 32 |
| 33 } // namespace | 33 } // namespace |
| 34 | 34 |
| 35 namespace extensions { | 35 namespace extensions { |
| 36 | 36 |
| 37 class FakeSerialGetDevicesFunction : public AsyncExtensionFunction { | 37 class FakeSerialGetDevicesFunction : public AsyncExtensionFunction { |
| 38 public: | 38 public: |
| 39 virtual bool RunImpl() OVERRIDE { | 39 virtual bool RunAsync() OVERRIDE { |
| 40 base::ListValue* devices = new base::ListValue(); | 40 base::ListValue* devices = new base::ListValue(); |
| 41 base::DictionaryValue* device0 = new base::DictionaryValue(); | 41 base::DictionaryValue* device0 = new base::DictionaryValue(); |
| 42 device0->SetString("path", "/dev/fakeserial"); | 42 device0->SetString("path", "/dev/fakeserial"); |
| 43 base::DictionaryValue* device1 = new base::DictionaryValue(); | 43 base::DictionaryValue* device1 = new base::DictionaryValue(); |
| 44 device1->SetString("path", "\\\\COM800\\"); | 44 device1->SetString("path", "\\\\COM800\\"); |
| 45 devices->Append(device0); | 45 devices->Append(device0); |
| 46 devices->Append(device1); | 46 devices->Append(device1); |
| 47 SetResult(devices); | 47 SetResult(devices); |
| 48 SendResponse(true); | 48 SendResponse(true); |
| 49 return true; | 49 return true; |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 | 183 |
| 184 ASSERT_TRUE(RunExtensionTest("serial/api")) << message_; | 184 ASSERT_TRUE(RunExtensionTest("serial/api")) << message_; |
| 185 } | 185 } |
| 186 | 186 |
| 187 IN_PROC_BROWSER_TEST_F(SerialApiTest, SerialRealHardware) { | 187 IN_PROC_BROWSER_TEST_F(SerialApiTest, SerialRealHardware) { |
| 188 ResultCatcher catcher; | 188 ResultCatcher catcher; |
| 189 catcher.RestrictToProfile(browser()->profile()); | 189 catcher.RestrictToProfile(browser()->profile()); |
| 190 | 190 |
| 191 ASSERT_TRUE(RunExtensionTest("serial/real_hardware")) << message_; | 191 ASSERT_TRUE(RunExtensionTest("serial/real_hardware")) << message_; |
| 192 } | 192 } |
| OLD | NEW |