Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(238)

Side by Side Diff: extensions/renderer/api/serial/serial_api_unittest.cc

Issue 652313002: Enable the mojo-based serial API in the renderer behind a flag. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mojo-js-natives-registration
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 virtual void SetUp() override { 398 virtual 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 } 403 }
415 404
416 scoped_refptr<TestIoHandlerBase> io_handler_; 405 scoped_refptr<TestIoHandlerBase> io_handler_;
417 406
418 private: 407 private:
419 scoped_refptr<device::SerialIoHandler> GetIoHandler() { 408 scoped_refptr<device::SerialIoHandler> GetIoHandler() {
420 if (!io_handler_.get()) 409 if (!io_handler_.get())
421 io_handler_ = new TestIoHandlerBase; 410 io_handler_ = new TestIoHandlerBase;
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
635 624
636 TEST_F(SerialApiTest, SetPausedUnknownConnectionId) { 625 TEST_F(SerialApiTest, SetPausedUnknownConnectionId) {
637 RunTest("serial_unittest.js", "testSetPausedUnknownConnectionId"); 626 RunTest("serial_unittest.js", "testSetPausedUnknownConnectionId");
638 } 627 }
639 628
640 TEST_F(SerialApiTest, SendUnknownConnectionId) { 629 TEST_F(SerialApiTest, SendUnknownConnectionId) {
641 RunTest("serial_unittest.js", "testSendUnknownConnectionId"); 630 RunTest("serial_unittest.js", "testSendUnknownConnectionId");
642 } 631 }
643 632
644 } // namespace extensions 633 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698