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

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

Issue 502893002: Fix some leaks and failures under valgrind in JS extensions unit tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: SetUp Created 6 years, 3 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 | « no previous file | extensions/renderer/module_system_test.h » ('j') | 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 "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 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 306
307 virtual void SetUp() OVERRIDE { 307 virtual void SetUp() OVERRIDE {
308 ApiTestBase::SetUp(); 308 ApiTestBase::SetUp();
309 env()->RegisterModule("serial", IDR_SERIAL_CUSTOM_BINDINGS_JS); 309 env()->RegisterModule("serial", IDR_SERIAL_CUSTOM_BINDINGS_JS);
310 env()->RegisterModule("serial_service", IDR_SERIAL_SERVICE_JS); 310 env()->RegisterModule("serial_service", IDR_SERIAL_SERVICE_JS);
311 env()->RegisterModule("device/serial/serial.mojom", IDR_SERIAL_MOJOM_JS); 311 env()->RegisterModule("device/serial/serial.mojom", IDR_SERIAL_MOJOM_JS);
312 service_provider()->AddService<device::serial::SerialService>(base::Bind( 312 service_provider()->AddService<device::serial::SerialService>(base::Bind(
313 &SerialApiTest::CreateSerialService, base::Unretained(this))); 313 &SerialApiTest::CreateSerialService, base::Unretained(this)));
314 } 314 }
315 315
316 virtual void TearDown() OVERRIDE {
317 if (io_handler_.get())
318 EXPECT_TRUE(io_handler_->HasOneRef());
319 ApiTestBase::TearDown();
320 }
321
322 scoped_refptr<TestIoHandlerBase> io_handler_; 316 scoped_refptr<TestIoHandlerBase> io_handler_;
323 317
324 private: 318 private:
325 scoped_refptr<device::SerialIoHandler> GetIoHandler() { 319 scoped_refptr<device::SerialIoHandler> GetIoHandler() {
326 if (!io_handler_.get()) 320 if (!io_handler_.get())
327 io_handler_ = new TestIoHandlerBase; 321 io_handler_ = new TestIoHandlerBase;
328 return io_handler_; 322 return io_handler_;
329 } 323 }
330 324
331 void CreateSerialService( 325 void CreateSerialService(
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
438 432
439 TEST_F(SerialApiTest, FlushUnknownConnectionId) { 433 TEST_F(SerialApiTest, FlushUnknownConnectionId) {
440 RunTest("serial_unittest.js", "testFlushUnknownConnectionId"); 434 RunTest("serial_unittest.js", "testFlushUnknownConnectionId");
441 } 435 }
442 436
443 TEST_F(SerialApiTest, SetPausedUnknownConnectionId) { 437 TEST_F(SerialApiTest, SetPausedUnknownConnectionId) {
444 RunTest("serial_unittest.js", "testSetPausedUnknownConnectionId"); 438 RunTest("serial_unittest.js", "testSetPausedUnknownConnectionId");
445 } 439 }
446 440
447 } // namespace extensions 441 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | extensions/renderer/module_system_test.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698