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

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

Issue 1143013002: Remove mojo::InterfaceImpl from device/serial. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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
« no previous file with comments | « extensions/browser/api/serial/serial_apitest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "base/thread_task_runner_handle.h" 5 #include "base/thread_task_runner_handle.h"
6 #include "device/serial/serial_device_enumerator.h" 6 #include "device/serial/serial_device_enumerator.h"
7 #include "device/serial/serial_service_impl.h" 7 #include "device/serial/serial_service_impl.h"
8 #include "device/serial/test_serial_io_handler.h" 8 #include "device/serial/test_serial_io_handler.h"
9 #include "extensions/browser/mojo/stash_backend.h" 9 #include "extensions/browser/mojo/stash_backend.h"
10 #include "extensions/common/mojo/keep_alive.mojom.h" 10 #include "extensions/common/mojo/keep_alive.mojom.h"
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 429
430 private: 430 private:
431 scoped_refptr<device::SerialIoHandler> GetIoHandler() { 431 scoped_refptr<device::SerialIoHandler> GetIoHandler() {
432 if (!io_handler_.get()) 432 if (!io_handler_.get())
433 io_handler_ = new TestIoHandlerBase; 433 io_handler_ = new TestIoHandlerBase;
434 return io_handler_; 434 return io_handler_;
435 } 435 }
436 436
437 void CreateSerialService( 437 void CreateSerialService(
438 mojo::InterfaceRequest<device::serial::SerialService> request) { 438 mojo::InterfaceRequest<device::serial::SerialService> request) {
439 mojo::BindToRequest(new device::SerialServiceImpl( 439 new device::SerialServiceImpl(
440 new device::SerialConnectionFactory( 440 new device::SerialConnectionFactory(
441 base::Bind(&SerialApiTest::GetIoHandler, 441 base::Bind(&SerialApiTest::GetIoHandler, base::Unretained(this)),
442 base::Unretained(this)), 442 base::ThreadTaskRunnerHandle::Get()),
443 base::ThreadTaskRunnerHandle::Get()), 443 scoped_ptr<device::SerialDeviceEnumerator>(
444 scoped_ptr<device::SerialDeviceEnumerator>( 444 new FakeSerialDeviceEnumerator),
445 new FakeSerialDeviceEnumerator)), 445 request.Pass());
446 &request);
447 } 446 }
448 447
449 DISALLOW_COPY_AND_ASSIGN(SerialApiTest); 448 DISALLOW_COPY_AND_ASSIGN(SerialApiTest);
450 }; 449 };
451 450
452 TEST_F(SerialApiTest, GetDevices) { 451 TEST_F(SerialApiTest, GetDevices) {
453 RunTest("serial_unittest.js", "testGetDevices"); 452 RunTest("serial_unittest.js", "testGetDevices");
454 } 453 }
455 454
456 TEST_F(SerialApiTest, ConnectFail) { 455 TEST_F(SerialApiTest, ConnectFail) {
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
679 RunTest("serial_unittest.js", "testStashNoConnections")); 678 RunTest("serial_unittest.js", "testStashNoConnections"));
680 env()->context()->DispatchOnUnloadEvent(); 679 env()->context()->DispatchOnUnloadEvent();
681 io_handler_ = nullptr; 680 io_handler_ = nullptr;
682 scoped_ptr<ModuleSystemTestEnvironment> new_env(CreateEnvironment()); 681 scoped_ptr<ModuleSystemTestEnvironment> new_env(CreateEnvironment());
683 ApiTestEnvironment new_api_test_env(new_env.get()); 682 ApiTestEnvironment new_api_test_env(new_env.get());
684 PrepareEnvironment(&new_api_test_env, stash_backend_.get()); 683 PrepareEnvironment(&new_api_test_env, stash_backend_.get());
685 new_api_test_env.RunTest("serial_unittest.js", "testRestoreNoConnections"); 684 new_api_test_env.RunTest("serial_unittest.js", "testRestoreNoConnections");
686 } 685 }
687 686
688 } // namespace extensions 687 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/api/serial/serial_apitest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698