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

Side by Side Diff: extensions/browser/api/sockets_udp/sockets_udp_api_unittest.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/memory/scoped_ptr.h" 5 #include "extensions/browser/api/sockets_udp/sockets_udp_api.h"
6
7 #include <memory>
8
9 #include "base/memory/ptr_util.h"
6 #include "base/values.h" 10 #include "base/values.h"
7 #include "extensions/browser/api/api_resource_manager.h" 11 #include "extensions/browser/api/api_resource_manager.h"
8 #include "extensions/browser/api/socket/socket.h" 12 #include "extensions/browser/api/socket/socket.h"
9 #include "extensions/browser/api/socket/udp_socket.h" 13 #include "extensions/browser/api/socket/udp_socket.h"
10 #include "extensions/browser/api/sockets_udp/sockets_udp_api.h"
11 #include "extensions/browser/api_unittest.h" 14 #include "extensions/browser/api_unittest.h"
12 #include "testing/gmock/include/gmock/gmock.h" 15 #include "testing/gmock/include/gmock/gmock.h"
13 #include "testing/gtest/include/gtest/gtest.h" 16 #include "testing/gtest/include/gtest/gtest.h"
14 17
15 namespace extensions { 18 namespace extensions {
16 namespace api { 19 namespace api {
17 20
18 static scoped_ptr<KeyedService> ApiResourceManagerTestFactory( 21 static std::unique_ptr<KeyedService> ApiResourceManagerTestFactory(
19 content::BrowserContext* context) { 22 content::BrowserContext* context) {
20 return make_scoped_ptr(new ApiResourceManager<ResumableUDPSocket>(context)); 23 return base::WrapUnique(new ApiResourceManager<ResumableUDPSocket>(context));
21 } 24 }
22 25
23 class SocketsUdpUnitTest : public ApiUnitTest { 26 class SocketsUdpUnitTest : public ApiUnitTest {
24 public: 27 public:
25 void SetUp() override { 28 void SetUp() override {
26 ApiUnitTest::SetUp(); 29 ApiUnitTest::SetUp();
27 30
28 ApiResourceManager<ResumableUDPSocket>::GetFactoryInstance() 31 ApiResourceManager<ResumableUDPSocket>::GetFactoryInstance()
29 ->SetTestingFactoryAndUse(browser_context(), 32 ->SetTestingFactoryAndUse(browser_context(),
30 ApiResourceManagerTestFactory); 33 ApiResourceManagerTestFactory);
31 } 34 }
32 }; 35 };
33 36
34 TEST_F(SocketsUdpUnitTest, Create) { 37 TEST_F(SocketsUdpUnitTest, Create) {
35 // Get BrowserThread 38 // Get BrowserThread
36 content::BrowserThread::ID id; 39 content::BrowserThread::ID id;
37 CHECK(content::BrowserThread::GetCurrentThreadIdentifier(&id)); 40 CHECK(content::BrowserThread::GetCurrentThreadIdentifier(&id));
38 41
39 // Create SocketCreateFunction and put it on BrowserThread 42 // Create SocketCreateFunction and put it on BrowserThread
40 SocketsUdpCreateFunction* function = new SocketsUdpCreateFunction(); 43 SocketsUdpCreateFunction* function = new SocketsUdpCreateFunction();
41 function->set_work_thread_id(id); 44 function->set_work_thread_id(id);
42 45
43 // Run tests 46 // Run tests
44 scoped_ptr<base::DictionaryValue> result(RunFunctionAndReturnDictionary( 47 std::unique_ptr<base::DictionaryValue> result(RunFunctionAndReturnDictionary(
45 function, "[{\"persistent\": true, \"name\": \"foo\"}]")); 48 function, "[{\"persistent\": true, \"name\": \"foo\"}]"));
46 ASSERT_TRUE(result.get()); 49 ASSERT_TRUE(result.get());
47 } 50 }
48 51
49 } // namespace api 52 } // namespace api
50 } // namespace extensions 53 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/api/sockets_udp/sockets_udp_api.cc ('k') | extensions/browser/api/sockets_udp/sockets_udp_apitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698