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

Side by Side Diff: extensions/browser/api/bluetooth_socket/bluetooth_socket_apitest.cc

Issue 1902873002: Convert //extensions/browser/api from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 <memory>
5 #include <string> 6 #include <string>
6 7
7 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
8 #include "base/memory/scoped_ptr.h"
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "device/bluetooth/bluetooth_adapter_factory.h" 10 #include "device/bluetooth/bluetooth_adapter_factory.h"
11 #include "device/bluetooth/bluetooth_uuid.h" 11 #include "device/bluetooth/bluetooth_uuid.h"
12 #include "device/bluetooth/test/mock_bluetooth_adapter.h" 12 #include "device/bluetooth/test/mock_bluetooth_adapter.h"
13 #include "device/bluetooth/test/mock_bluetooth_device.h" 13 #include "device/bluetooth/test/mock_bluetooth_device.h"
14 #include "device/bluetooth/test/mock_bluetooth_socket.h" 14 #include "device/bluetooth/test/mock_bluetooth_socket.h"
15 #include "extensions/browser/api/bluetooth_socket/bluetooth_socket_api.h" 15 #include "extensions/browser/api/bluetooth_socket/bluetooth_socket_api.h"
16 #include "extensions/common/test_util.h" 16 #include "extensions/common/test_util.h"
17 #include "extensions/shell/test/shell_apitest.h" 17 #include "extensions/shell/test/shell_apitest.h"
18 #include "extensions/test/extension_test_message_listener.h" 18 #include "extensions/test/extension_test_message_listener.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 new testing::NiceMock<MockBluetoothDevice>(mock_adapter_.get(), 60 new testing::NiceMock<MockBluetoothDevice>(mock_adapter_.get(),
61 0, 61 0,
62 "d2", 62 "d2",
63 "21:22:23:24:25:26", 63 "21:22:23:24:25:26",
64 true /* paired */, 64 true /* paired */,
65 false /* connected */)); 65 false /* connected */));
66 } 66 }
67 67
68 protected: 68 protected:
69 scoped_refptr<testing::StrictMock<MockBluetoothAdapter> > mock_adapter_; 69 scoped_refptr<testing::StrictMock<MockBluetoothAdapter> > mock_adapter_;
70 scoped_ptr<testing::NiceMock<MockBluetoothDevice> > mock_device1_; 70 std::unique_ptr<testing::NiceMock<MockBluetoothDevice>> mock_device1_;
71 scoped_ptr<testing::NiceMock<MockBluetoothDevice> > mock_device2_; 71 std::unique_ptr<testing::NiceMock<MockBluetoothDevice>> mock_device2_;
72 72
73 private: 73 private:
74 scoped_refptr<Extension> empty_extension_; 74 scoped_refptr<Extension> empty_extension_;
75 }; 75 };
76 76
77 // testing::InvokeArgument<N> does not work with base::Callback, fortunately 77 // testing::InvokeArgument<N> does not work with base::Callback, fortunately
78 // gmock makes it simple to create action templates that do for the various 78 // gmock makes it simple to create action templates that do for the various
79 // possible numbers of arguments. 79 // possible numbers of arguments.
80 ACTION_TEMPLATE(InvokeCallbackArgument, 80 ACTION_TEMPLATE(InvokeCallbackArgument,
81 HAS_1_TEMPLATE_PARAMS(int, k), 81 HAS_1_TEMPLATE_PARAMS(int, k),
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 ResultCatcher catcher; 208 ResultCatcher catcher;
209 catcher.RestrictToBrowserContext(browser_context()); 209 catcher.RestrictToBrowserContext(browser_context());
210 210
211 // Run the test. 211 // Run the test.
212 scoped_refptr<const Extension> extension( 212 scoped_refptr<const Extension> extension(
213 LoadApp("api_test/bluetooth_socket/permission_denied")); 213 LoadApp("api_test/bluetooth_socket/permission_denied"));
214 ASSERT_TRUE(extension.get()); 214 ASSERT_TRUE(extension.get());
215 215
216 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); 216 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message();
217 } 217 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698