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

Side by Side Diff: extensions/browser/api/sockets_tcp_server/sockets_tcp_server_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 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 <utility> 5 #include <utility>
6 6
7 #include "base/memory/ref_counted.h" 7 #include "base/memory/ref_counted.h"
8 #include "base/strings/stringprintf.h" 8 #include "base/strings/stringprintf.h"
9 #include "extensions/browser/api/dns/host_resolver_wrapper.h" 9 #include "extensions/browser/api/dns/host_resolver_wrapper.h"
10 #include "extensions/browser/api/dns/mock_host_resolver_creator.h" 10 #include "extensions/browser/api/dns/mock_host_resolver_creator.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 }; 52 };
53 53
54 IN_PROC_BROWSER_TEST_F(SocketsTcpServerApiTest, SocketTCPCreateGood) { 54 IN_PROC_BROWSER_TEST_F(SocketsTcpServerApiTest, SocketTCPCreateGood) {
55 scoped_refptr<api::SocketsTcpServerCreateFunction> socket_create_function( 55 scoped_refptr<api::SocketsTcpServerCreateFunction> socket_create_function(
56 new api::SocketsTcpServerCreateFunction()); 56 new api::SocketsTcpServerCreateFunction());
57 scoped_refptr<Extension> empty_extension(test_util::CreateEmptyExtension()); 57 scoped_refptr<Extension> empty_extension(test_util::CreateEmptyExtension());
58 58
59 socket_create_function->set_extension(empty_extension.get()); 59 socket_create_function->set_extension(empty_extension.get());
60 socket_create_function->set_has_callback(true); 60 socket_create_function->set_has_callback(true);
61 61
62 scoped_ptr<base::Value> result( 62 std::unique_ptr<base::Value> result(
63 api_test_utils::RunFunctionAndReturnSingleResult( 63 api_test_utils::RunFunctionAndReturnSingleResult(
64 socket_create_function.get(), "[]", browser_context())); 64 socket_create_function.get(), "[]", browser_context()));
65 ASSERT_EQ(base::Value::TYPE_DICTIONARY, result->GetType()); 65 ASSERT_EQ(base::Value::TYPE_DICTIONARY, result->GetType());
66 scoped_ptr<base::DictionaryValue> value = 66 std::unique_ptr<base::DictionaryValue> value =
67 base::DictionaryValue::From(std::move(result)); 67 base::DictionaryValue::From(std::move(result));
68 int socketId = -1; 68 int socketId = -1;
69 EXPECT_TRUE(value->GetInteger("socketId", &socketId)); 69 EXPECT_TRUE(value->GetInteger("socketId", &socketId));
70 ASSERT_TRUE(socketId > 0); 70 ASSERT_TRUE(socketId > 0);
71 } 71 }
72 72
73 IN_PROC_BROWSER_TEST_F(SocketsTcpServerApiTest, SocketTCPServerExtension) { 73 IN_PROC_BROWSER_TEST_F(SocketsTcpServerApiTest, SocketTCPServerExtension) {
74 ResultCatcher catcher; 74 ResultCatcher catcher;
75 catcher.RestrictToBrowserContext(browser_context()); 75 catcher.RestrictToBrowserContext(browser_context());
76 ExtensionTestMessageListener listener("info_please", true); 76 ExtensionTestMessageListener listener("info_please", true);
(...skipping 14 matching lines...) Expand all
91 ASSERT_TRUE(extension); 91 ASSERT_TRUE(extension);
92 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); 92 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message();
93 93
94 UnloadApp(extension); 94 UnloadApp(extension);
95 95
96 ASSERT_TRUE(LoadApp(path)) << message_; 96 ASSERT_TRUE(LoadApp(path)) << message_;
97 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); 97 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message();
98 } 98 }
99 99
100 } // namespace extensions 100 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698