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 "device/serial/serial_device_enumerator.h" | 5 #include "device/serial/serial_device_enumerator.h" |
6 #include "device/serial/serial_service_impl.h" | 6 #include "device/serial/serial_service_impl.h" |
7 #include "device/serial/test_serial_io_handler.h" | 7 #include "device/serial/test_serial_io_handler.h" |
| 8 #include "extensions/common/mojo/keep_alive.mojom.h" |
8 #include "extensions/renderer/api_test_base.h" | 9 #include "extensions/renderer/api_test_base.h" |
9 #include "grit/extensions_renderer_resources.h" | 10 #include "grit/extensions_renderer_resources.h" |
10 | 11 |
11 // A test launcher for tests for the serial API defined in | 12 // A test launcher for tests for the serial API defined in |
12 // extensions/test/data/serial_unittest.js. Each C++ test function sets up a | 13 // extensions/test/data/serial_unittest.js. Each C++ test function sets up a |
13 // fake DeviceEnumerator or SerialIoHandler expecting or returning particular | 14 // fake DeviceEnumerator or SerialIoHandler expecting or returning particular |
14 // values for that test. | 15 // values for that test. |
15 | 16 |
16 namespace extensions { | 17 namespace extensions { |
17 | 18 |
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 env()->RegisterModule("serial_service", IDR_SERIAL_SERVICE_JS); | 404 env()->RegisterModule("serial_service", IDR_SERIAL_SERVICE_JS); |
404 env()->RegisterModule("device/serial/data_stream.mojom", | 405 env()->RegisterModule("device/serial/data_stream.mojom", |
405 IDR_DATA_STREAM_MOJOM_JS); | 406 IDR_DATA_STREAM_MOJOM_JS); |
406 env()->RegisterModule("device/serial/data_stream_serialization.mojom", | 407 env()->RegisterModule("device/serial/data_stream_serialization.mojom", |
407 IDR_DATA_STREAM_SERIALIZATION_MOJOM_JS); | 408 IDR_DATA_STREAM_SERIALIZATION_MOJOM_JS); |
408 env()->RegisterModule("device/serial/serial.mojom", IDR_SERIAL_MOJOM_JS); | 409 env()->RegisterModule("device/serial/serial.mojom", IDR_SERIAL_MOJOM_JS); |
409 env()->RegisterModule("device/serial/serial_serialization.mojom", | 410 env()->RegisterModule("device/serial/serial_serialization.mojom", |
410 IDR_SERIAL_SERIALIZATION_MOJOM_JS); | 411 IDR_SERIAL_SERIALIZATION_MOJOM_JS); |
411 service_provider()->AddService<device::serial::SerialService>(base::Bind( | 412 service_provider()->AddService<device::serial::SerialService>(base::Bind( |
412 &SerialApiTest::CreateSerialService, base::Unretained(this))); | 413 &SerialApiTest::CreateSerialService, base::Unretained(this))); |
| 414 service_provider()->IgnoreServiceRequests<KeepAlive>(); |
413 } | 415 } |
414 | 416 |
415 scoped_refptr<TestIoHandlerBase> io_handler_; | 417 scoped_refptr<TestIoHandlerBase> io_handler_; |
416 | 418 |
417 private: | 419 private: |
418 scoped_refptr<device::SerialIoHandler> GetIoHandler() { | 420 scoped_refptr<device::SerialIoHandler> GetIoHandler() { |
419 if (!io_handler_.get()) | 421 if (!io_handler_.get()) |
420 io_handler_ = new TestIoHandlerBase; | 422 io_handler_ = new TestIoHandlerBase; |
421 return io_handler_; | 423 return io_handler_; |
422 } | 424 } |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
634 | 636 |
635 TEST_F(SerialApiTest, SetPausedUnknownConnectionId) { | 637 TEST_F(SerialApiTest, SetPausedUnknownConnectionId) { |
636 RunTest("serial_unittest.js", "testSetPausedUnknownConnectionId"); | 638 RunTest("serial_unittest.js", "testSetPausedUnknownConnectionId"); |
637 } | 639 } |
638 | 640 |
639 TEST_F(SerialApiTest, SendUnknownConnectionId) { | 641 TEST_F(SerialApiTest, SendUnknownConnectionId) { |
640 RunTest("serial_unittest.js", "testSendUnknownConnectionId"); | 642 RunTest("serial_unittest.js", "testSendUnknownConnectionId"); |
641 } | 643 } |
642 | 644 |
643 } // namespace extensions | 645 } // namespace extensions |
OLD | NEW |