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 <stdint.h> | 5 #include <stdint.h> |
6 | 6 |
7 #include <queue> | 7 #include <queue> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "device/serial/data_source_sender.h" | 11 #include "device/serial/data_source_sender.h" |
12 #include "device/serial/data_stream.mojom.h" | 12 #include "device/serial/data_stream.mojom.h" |
13 #include "extensions/renderer/api_test_base.h" | 13 #include "extensions/renderer/api_test_base.h" |
14 #include "gin/dictionary.h" | 14 #include "gin/dictionary.h" |
15 #include "gin/wrappable.h" | 15 #include "gin/wrappable.h" |
16 #include "grit/extensions_renderer_resources.h" | 16 #include "grit/extensions_renderer_resources.h" |
| 17 #include "mojo/edk/js/handle.h" |
17 | 18 |
18 namespace extensions { | 19 namespace extensions { |
19 | 20 |
20 class DataReceiverFactory : public gin::Wrappable<DataReceiverFactory> { | 21 class DataReceiverFactory : public gin::Wrappable<DataReceiverFactory> { |
21 public: | 22 public: |
22 using Callback = base::Callback<void( | 23 using Callback = base::Callback<void( |
23 mojo::InterfaceRequest<device::serial::DataSource>, | 24 mojo::InterfaceRequest<device::serial::DataSource>, |
24 mojo::InterfacePtr<device::serial::DataSourceClient>)>; | 25 mojo::InterfacePtr<device::serial::DataSourceClient>)>; |
25 static gin::Handle<DataReceiverFactory> Create(v8::Isolate* isolate, | 26 static gin::Handle<DataReceiverFactory> Create(v8::Isolate* isolate, |
26 const Callback& callback) { | 27 const Callback& callback) { |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 data_to_send_.push("a"); | 175 data_to_send_.push("a"); |
175 RunTest("data_receiver_unittest.js", "testSerializeDuringReceive"); | 176 RunTest("data_receiver_unittest.js", "testSerializeDuringReceive"); |
176 } | 177 } |
177 | 178 |
178 TEST_F(DataReceiverTest, SerializeAfterClose) { | 179 TEST_F(DataReceiverTest, SerializeAfterClose) { |
179 data_to_send_.push("a"); | 180 data_to_send_.push("a"); |
180 RunTest("data_receiver_unittest.js", "testSerializeAfterClose"); | 181 RunTest("data_receiver_unittest.js", "testSerializeAfterClose"); |
181 } | 182 } |
182 | 183 |
183 } // namespace extensions | 184 } // namespace extensions |
OLD | NEW |