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