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

Side by Side Diff: extensions/browser/api/sockets_tcp/sockets_tcp_apitest.cc

Issue 1308013005: Add scoped_ptr-safe base::Value to Dictionary/List conversion functions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Made conversions static members. Created 5 years, 3 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
« no previous file with comments | « base/values.cc ('k') | extensions/browser/api/sockets_tcp_server/sockets_tcp_server_apitest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "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/dns/host_resolver_wrapper.h" 7 #include "extensions/browser/api/dns/host_resolver_wrapper.h"
8 #include "extensions/browser/api/dns/mock_host_resolver_creator.h" 8 #include "extensions/browser/api/dns/mock_host_resolver_creator.h"
9 #include "extensions/browser/api/sockets_tcp/sockets_tcp_api.h" 9 #include "extensions/browser/api/sockets_tcp/sockets_tcp_api.h"
10 #include "extensions/browser/api_test_utils.h" 10 #include "extensions/browser/api_test_utils.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 scoped_refptr<Extension> empty_extension = test_util::CreateEmptyExtension(); 56 scoped_refptr<Extension> empty_extension = test_util::CreateEmptyExtension();
57 57
58 socket_create_function->set_extension(empty_extension.get()); 58 socket_create_function->set_extension(empty_extension.get());
59 socket_create_function->set_has_callback(true); 59 socket_create_function->set_has_callback(true);
60 60
61 scoped_ptr<base::Value> result( 61 scoped_ptr<base::Value> result(
62 api_test_utils::RunFunctionAndReturnSingleResult( 62 api_test_utils::RunFunctionAndReturnSingleResult(
63 socket_create_function.get(), "[]", browser_context())); 63 socket_create_function.get(), "[]", browser_context()));
64 64
65 ASSERT_EQ(base::Value::TYPE_DICTIONARY, result->GetType()); 65 ASSERT_EQ(base::Value::TYPE_DICTIONARY, result->GetType());
66 base::DictionaryValue* value = 66 scoped_ptr<base::DictionaryValue> value =
67 static_cast<base::DictionaryValue*>(result.get()); 67 base::DictionaryValue::From(result.Pass());
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(SocketsTcpApiTest, SocketTcpExtension) { 73 IN_PROC_BROWSER_TEST_F(SocketsTcpApiTest, SocketTcpExtension) {
74 scoped_ptr<net::SpawnedTestServer> test_server(new net::SpawnedTestServer( 74 scoped_ptr<net::SpawnedTestServer> test_server(new net::SpawnedTestServer(
75 net::SpawnedTestServer::TYPE_TCP_ECHO, net::SpawnedTestServer::kLocalhost, 75 net::SpawnedTestServer::TYPE_TCP_ECHO, net::SpawnedTestServer::kLocalhost,
76 base::FilePath(FILE_PATH_LITERAL("net/data")))); 76 base::FilePath(FILE_PATH_LITERAL("net/data"))));
77 EXPECT_TRUE(test_server->Start()); 77 EXPECT_TRUE(test_server->Start());
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 114
115 ASSERT_TRUE(LoadApp("sockets_tcp/api")); 115 ASSERT_TRUE(LoadApp("sockets_tcp/api"));
116 EXPECT_TRUE(listener.WaitUntilSatisfied()); 116 EXPECT_TRUE(listener.WaitUntilSatisfied());
117 listener.Reply(base::StringPrintf( 117 listener.Reply(base::StringPrintf(
118 "https:%s:%d", https_host_port_pair.host().c_str(), https_port)); 118 "https:%s:%d", https_host_port_pair.host().c_str(), https_port));
119 119
120 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); 120 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message();
121 } 121 }
122 122
123 } // namespace extensions 123 } // namespace extensions
OLDNEW
« no previous file with comments | « base/values.cc ('k') | extensions/browser/api/sockets_tcp_server/sockets_tcp_server_apitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698