| 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/common/mojo/keep_alive.mojom.h" |
| 9 #include "extensions/renderer/api_test_base.h" | 9 #include "extensions/renderer/api_test_base.h" |
| 10 #include "grit/extensions_renderer_resources.h" | 10 #include "grit/extensions_renderer_resources.h" |
| (...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 }; | 390 }; |
| 391 | 391 |
| 392 } // namespace | 392 } // namespace |
| 393 | 393 |
| 394 class SerialApiTest : public ApiTestBase { | 394 class SerialApiTest : public ApiTestBase { |
| 395 public: | 395 public: |
| 396 SerialApiTest() {} | 396 SerialApiTest() {} |
| 397 | 397 |
| 398 void SetUp() override { | 398 void SetUp() override { |
| 399 ApiTestBase::SetUp(); | 399 ApiTestBase::SetUp(); |
| 400 env()->RegisterModule("async_waiter", IDR_ASYNC_WAITER_JS); | |
| 401 env()->RegisterModule("data_receiver", IDR_DATA_RECEIVER_JS); | |
| 402 env()->RegisterModule("data_sender", IDR_DATA_SENDER_JS); | |
| 403 env()->RegisterModule("serial", IDR_SERIAL_CUSTOM_BINDINGS_JS); | 400 env()->RegisterModule("serial", IDR_SERIAL_CUSTOM_BINDINGS_JS); |
| 404 env()->RegisterModule("serial_service", IDR_SERIAL_SERVICE_JS); | |
| 405 env()->RegisterModule("device/serial/data_stream.mojom", | |
| 406 IDR_DATA_STREAM_MOJOM_JS); | |
| 407 env()->RegisterModule("device/serial/data_stream_serialization.mojom", | |
| 408 IDR_DATA_STREAM_SERIALIZATION_MOJOM_JS); | |
| 409 env()->RegisterModule("device/serial/serial.mojom", IDR_SERIAL_MOJOM_JS); | |
| 410 env()->RegisterModule("device/serial/serial_serialization.mojom", | |
| 411 IDR_SERIAL_SERIALIZATION_MOJOM_JS); | |
| 412 service_provider()->AddService<device::serial::SerialService>(base::Bind( | 401 service_provider()->AddService<device::serial::SerialService>(base::Bind( |
| 413 &SerialApiTest::CreateSerialService, base::Unretained(this))); | 402 &SerialApiTest::CreateSerialService, base::Unretained(this))); |
| 414 service_provider()->IgnoreServiceRequests<KeepAlive>(); | 403 service_provider()->IgnoreServiceRequests<KeepAlive>(); |
| 415 } | 404 } |
| 416 | 405 |
| 417 scoped_refptr<TestIoHandlerBase> io_handler_; | 406 scoped_refptr<TestIoHandlerBase> io_handler_; |
| 418 | 407 |
| 419 private: | 408 private: |
| 420 scoped_refptr<device::SerialIoHandler> GetIoHandler() { | 409 scoped_refptr<device::SerialIoHandler> GetIoHandler() { |
| 421 if (!io_handler_.get()) | 410 if (!io_handler_.get()) |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 636 | 625 |
| 637 TEST_F(SerialApiTest, SetPausedUnknownConnectionId) { | 626 TEST_F(SerialApiTest, SetPausedUnknownConnectionId) { |
| 638 RunTest("serial_unittest.js", "testSetPausedUnknownConnectionId"); | 627 RunTest("serial_unittest.js", "testSetPausedUnknownConnectionId"); |
| 639 } | 628 } |
| 640 | 629 |
| 641 TEST_F(SerialApiTest, SendUnknownConnectionId) { | 630 TEST_F(SerialApiTest, SendUnknownConnectionId) { |
| 642 RunTest("serial_unittest.js", "testSendUnknownConnectionId"); | 631 RunTest("serial_unittest.js", "testSendUnknownConnectionId"); |
| 643 } | 632 } |
| 644 | 633 |
| 645 } // namespace extensions | 634 } // namespace extensions |
| OLD | NEW |