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

Side by Side Diff: extensions/browser/api/system_network/system_network_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 "base/memory/ref_counted.h" 5 #include "base/memory/ref_counted.h"
6 #include "base/strings/stringprintf.h" 6 #include "base/strings/stringprintf.h"
7 #include "extensions/browser/api/system_network/system_network_api.h" 7 #include "extensions/browser/api/system_network/system_network_api.h"
8 #include "extensions/browser/api_test_utils.h" 8 #include "extensions/browser/api_test_utils.h"
9 #include "extensions/common/test_util.h" 9 #include "extensions/common/test_util.h"
10 #include "extensions/shell/test/shell_apitest.h" 10 #include "extensions/shell/test/shell_apitest.h"
(...skipping 16 matching lines...) Expand all
27 27
28 IN_PROC_BROWSER_TEST_F(SystemNetworkApiTest, GetNetworkInterfaces) { 28 IN_PROC_BROWSER_TEST_F(SystemNetworkApiTest, GetNetworkInterfaces) {
29 scoped_refptr<SystemNetworkGetNetworkInterfacesFunction> socket_function( 29 scoped_refptr<SystemNetworkGetNetworkInterfacesFunction> socket_function(
30 new SystemNetworkGetNetworkInterfacesFunction()); 30 new SystemNetworkGetNetworkInterfacesFunction());
31 scoped_refptr<Extension> empty_extension( 31 scoped_refptr<Extension> empty_extension(
32 extensions::test_util::CreateEmptyExtension()); 32 extensions::test_util::CreateEmptyExtension());
33 33
34 socket_function->set_extension(empty_extension.get()); 34 socket_function->set_extension(empty_extension.get());
35 socket_function->set_has_callback(true); 35 socket_function->set_has_callback(true);
36 36
37 scoped_ptr<base::Value> result(RunFunctionAndReturnSingleResult( 37 std::unique_ptr<base::Value> result(RunFunctionAndReturnSingleResult(
38 socket_function.get(), "[]", browser_context())); 38 socket_function.get(), "[]", browser_context()));
39 ASSERT_EQ(base::Value::TYPE_LIST, result->GetType()); 39 ASSERT_EQ(base::Value::TYPE_LIST, result->GetType());
40 40
41 // All we can confirm is that we have at least one address, but not what it 41 // All we can confirm is that we have at least one address, but not what it
42 // is. 42 // is.
43 base::ListValue* value = static_cast<base::ListValue*>(result.get()); 43 base::ListValue* value = static_cast<base::ListValue*>(result.get());
44 ASSERT_TRUE(value->GetSize() > 0); 44 ASSERT_TRUE(value->GetSize() > 0);
45 45
46 for (base::ListValue::const_iterator it = value->begin(); it != value->end(); 46 for (base::ListValue::const_iterator it = value->begin(); it != value->end();
47 ++it) { 47 ++it) {
48 base::Value* network_interface_value = *it; 48 base::Value* network_interface_value = *it;
49 49
50 NetworkInterface network_interface; 50 NetworkInterface network_interface;
51 ASSERT_TRUE(NetworkInterface::Populate(*network_interface_value, 51 ASSERT_TRUE(NetworkInterface::Populate(*network_interface_value,
52 &network_interface)); 52 &network_interface));
53 53
54 LOG(INFO) << "Network interface: address=" << network_interface.address 54 LOG(INFO) << "Network interface: address=" << network_interface.address
55 << ", name=" << network_interface.name 55 << ", name=" << network_interface.name
56 << ", prefix length=" << network_interface.prefix_length; 56 << ", prefix length=" << network_interface.prefix_length;
57 ASSERT_NE(std::string(), network_interface.address); 57 ASSERT_NE(std::string(), network_interface.address);
58 ASSERT_NE(std::string(), network_interface.name); 58 ASSERT_NE(std::string(), network_interface.name);
59 ASSERT_LE(0, network_interface.prefix_length); 59 ASSERT_LE(0, network_interface.prefix_length);
60 } 60 }
61 } 61 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698