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

Side by Side Diff: extensions/browser/api/bluetooth/bluetooth_apitest.cc

Issue 598173003: Run clang-modernize -use-nullptr over src/extensions/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <string.h> 5 #include <string.h>
6 6
7 #include "base/strings/stringprintf.h" 7 #include "base/strings/stringprintf.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "chrome/browser/extensions/extension_apitest.h" 9 #include "chrome/browser/extensions/extension_apitest.h"
10 #include "chrome/browser/extensions/extension_function_test_utils.h" 10 #include "chrome/browser/extensions/extension_function_test_utils.h"
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 EXPECT_CALL(*mock_adapter_, IsPowered()) 125 EXPECT_CALL(*mock_adapter_, IsPowered())
126 .WillOnce(testing::Return(true)); 126 .WillOnce(testing::Return(true));
127 EXPECT_CALL(*mock_adapter_, IsDiscovering()) 127 EXPECT_CALL(*mock_adapter_, IsDiscovering())
128 .WillOnce(testing::Return(false)); 128 .WillOnce(testing::Return(false));
129 129
130 scoped_refptr<api::BluetoothGetAdapterStateFunction> get_adapter_state; 130 scoped_refptr<api::BluetoothGetAdapterStateFunction> get_adapter_state;
131 get_adapter_state = setupFunction(new api::BluetoothGetAdapterStateFunction); 131 get_adapter_state = setupFunction(new api::BluetoothGetAdapterStateFunction);
132 132
133 scoped_ptr<base::Value> result(utils::RunFunctionAndReturnSingleResult( 133 scoped_ptr<base::Value> result(utils::RunFunctionAndReturnSingleResult(
134 get_adapter_state.get(), "[]", browser())); 134 get_adapter_state.get(), "[]", browser()));
135 ASSERT_TRUE(result.get() != NULL); 135 ASSERT_TRUE(result.get() != nullptr);
136 api::bluetooth::AdapterState state; 136 api::bluetooth::AdapterState state;
137 ASSERT_TRUE(api::bluetooth::AdapterState::Populate(*result, &state)); 137 ASSERT_TRUE(api::bluetooth::AdapterState::Populate(*result, &state));
138 138
139 EXPECT_FALSE(state.available); 139 EXPECT_FALSE(state.available);
140 EXPECT_TRUE(state.powered); 140 EXPECT_TRUE(state.powered);
141 EXPECT_FALSE(state.discovering); 141 EXPECT_FALSE(state.discovering);
142 EXPECT_EQ(kName, state.name); 142 EXPECT_EQ(kName, state.name);
143 EXPECT_EQ(kAdapterAddress, state.address); 143 EXPECT_EQ(kAdapterAddress, state.address);
144 } 144 }
145 145
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 } 382 }
383 383
384 IN_PROC_BROWSER_TEST_F(BluetoothApiTest, GetDevice) { 384 IN_PROC_BROWSER_TEST_F(BluetoothApiTest, GetDevice) {
385 ResultCatcher catcher; 385 ResultCatcher catcher;
386 catcher.RestrictToBrowserContext(browser()->profile()); 386 catcher.RestrictToBrowserContext(browser()->profile());
387 387
388 EXPECT_CALL(*mock_adapter_, GetDevice(device1_->GetAddress())) 388 EXPECT_CALL(*mock_adapter_, GetDevice(device1_->GetAddress()))
389 .WillOnce(testing::Return(device1_.get())); 389 .WillOnce(testing::Return(device1_.get()));
390 EXPECT_CALL(*mock_adapter_, GetDevice(device2_->GetAddress())) 390 EXPECT_CALL(*mock_adapter_, GetDevice(device2_->GetAddress()))
391 .Times(1) 391 .Times(1)
392 .WillRepeatedly(testing::Return(static_cast<BluetoothDevice*>(NULL))); 392 .WillRepeatedly(testing::Return(static_cast<BluetoothDevice*>(nullptr)));
Nico 2014/09/25 05:57:19 Hmm, is this static_cast still needed with nullptr
Sam McNally 2014/09/25 07:42:38 Clang on Linux and MSVC are both happy without the
Nico 2014/09/25 19:33:41 Hm, maybe we can contribute a patch to clang-moder
393 393
394 // Load and wait for setup 394 // Load and wait for setup
395 ExtensionTestMessageListener listener("ready", true); 395 ExtensionTestMessageListener listener("ready", true);
396 ASSERT_TRUE( 396 ASSERT_TRUE(
397 LoadExtension(test_data_dir_.AppendASCII("bluetooth/get_device"))); 397 LoadExtension(test_data_dir_.AppendASCII("bluetooth/get_device")));
398 EXPECT_TRUE(listener.WaitUntilSatisfied()); 398 EXPECT_TRUE(listener.WaitUntilSatisfied());
399 399
400 listener.Reply("go"); 400 listener.Reply("go");
401 401
402 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); 402 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message();
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 // Load and wait for setup 453 // Load and wait for setup
454 ExtensionTestMessageListener listener("ready", true); 454 ExtensionTestMessageListener listener("ready", true);
455 ASSERT_TRUE( 455 ASSERT_TRUE(
456 LoadExtension(test_data_dir_.AppendASCII("bluetooth/device_info"))); 456 LoadExtension(test_data_dir_.AppendASCII("bluetooth/device_info")));
457 EXPECT_TRUE(listener.WaitUntilSatisfied()); 457 EXPECT_TRUE(listener.WaitUntilSatisfied());
458 458
459 listener.Reply("go"); 459 listener.Reply("go");
460 460
461 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); 461 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message();
462 } 462 }
OLDNEW
« no previous file with comments | « extensions/browser/api/bluetooth/bluetooth_api.cc ('k') | extensions/browser/api/bluetooth/bluetooth_event_router.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698