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

Side by Side Diff: chrome/browser/extensions/api/socket/socket_apitest.cc

Issue 9372065: Update clients to use new TestServer constructor. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Remove files that were reviewed and committed separately. Created 8 years, 10 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/command_line.h" 5 #include "base/command_line.h"
6 #include "base/memory/ref_counted.h" 6 #include "base/memory/ref_counted.h"
7 #include "base/stringprintf.h" 7 #include "base/stringprintf.h"
8 #include "chrome/browser/extensions/api/socket/socket_api.h" 8 #include "chrome/browser/extensions/api/socket/socket_api.h"
9 #include "chrome/browser/extensions/extension_apitest.h" 9 #include "chrome/browser/extensions/extension_apitest.h"
10 #include "chrome/browser/extensions/extension_function_test_utils.h" 10 #include "chrome/browser/extensions/extension_function_test_utils.h"
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 // that doesn't run in production. Fix this when we're able to. 90 // that doesn't run in production. Fix this when we're able to.
91 RunFunctionAndReturnError( 91 RunFunctionAndReturnError(
92 socket_create_function, 92 socket_create_function,
93 GenerateCreateFunctionArgs("xxxx", kHostname, kPort), 93 GenerateCreateFunctionArgs("xxxx", kHostname, kPort),
94 browser(), NONE); 94 browser(), NONE);
95 } 95 }
96 96
97 IN_PROC_BROWSER_TEST_F(SocketApiTest, SocketUDPExtension) { 97 IN_PROC_BROWSER_TEST_F(SocketApiTest, SocketUDPExtension) {
98 scoped_ptr<net::TestServer> test_server( 98 scoped_ptr<net::TestServer> test_server(
99 new net::TestServer(net::TestServer::TYPE_UDP_ECHO, 99 new net::TestServer(net::TestServer::TYPE_UDP_ECHO,
100 net::TestServer::kLocalhost,
100 FilePath(FILE_PATH_LITERAL("net/data")))); 101 FilePath(FILE_PATH_LITERAL("net/data"))));
101 EXPECT_TRUE(test_server->Start()); 102 EXPECT_TRUE(test_server->Start());
102 103
103 net::HostPortPair host_port_pair = test_server->host_port_pair(); 104 net::HostPortPair host_port_pair = test_server->host_port_pair();
104 int port = host_port_pair.port(); 105 int port = host_port_pair.port();
105 ASSERT_TRUE(port > 0); 106 ASSERT_TRUE(port > 0);
106 107
107 ResultCatcher catcher; 108 ResultCatcher catcher;
108 catcher.RestrictToProfile(browser()->profile()); 109 catcher.RestrictToProfile(browser()->profile());
109 110
110 ExtensionTestMessageListener listener("info_please", true); 111 ExtensionTestMessageListener listener("info_please", true);
111 112
112 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("socket/api"))); 113 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("socket/api")));
113 EXPECT_TRUE(listener.WaitUntilSatisfied()); 114 EXPECT_TRUE(listener.WaitUntilSatisfied());
114 listener.Reply( 115 listener.Reply(
115 base::StringPrintf("udp:%s:%d", host_port_pair.host().c_str(), port)); 116 base::StringPrintf("udp:%s:%d", host_port_pair.host().c_str(), port));
116 117
117 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); 118 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message();
118 } 119 }
119 120
120 IN_PROC_BROWSER_TEST_F(SocketApiTest, SocketTCPExtension) { 121 IN_PROC_BROWSER_TEST_F(SocketApiTest, SocketTCPExtension) {
121 scoped_ptr<net::TestServer> test_server( 122 scoped_ptr<net::TestServer> test_server(
122 new net::TestServer(net::TestServer::TYPE_TCP_ECHO, 123 new net::TestServer(net::TestServer::TYPE_TCP_ECHO,
124 net::TestServer::kLocalhost,
123 FilePath(FILE_PATH_LITERAL("net/data")))); 125 FilePath(FILE_PATH_LITERAL("net/data"))));
124 EXPECT_TRUE(test_server->Start()); 126 EXPECT_TRUE(test_server->Start());
125 127
126 net::HostPortPair host_port_pair = test_server->host_port_pair(); 128 net::HostPortPair host_port_pair = test_server->host_port_pair();
127 int port = host_port_pair.port(); 129 int port = host_port_pair.port();
128 ASSERT_TRUE(port > 0); 130 ASSERT_TRUE(port > 0);
129 131
130 ResultCatcher catcher; 132 ResultCatcher catcher;
131 catcher.RestrictToProfile(browser()->profile()); 133 catcher.RestrictToProfile(browser()->profile());
132 134
133 ExtensionTestMessageListener listener("info_please", true); 135 ExtensionTestMessageListener listener("info_please", true);
134 136
135 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("socket/api"))); 137 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("socket/api")));
136 EXPECT_TRUE(listener.WaitUntilSatisfied()); 138 EXPECT_TRUE(listener.WaitUntilSatisfied());
137 listener.Reply( 139 listener.Reply(
138 base::StringPrintf("tcp:%s:%d", host_port_pair.host().c_str(), port)); 140 base::StringPrintf("tcp:%s:%d", host_port_pair.host().c_str(), port));
139 141
140 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); 142 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message();
141 } 143 }
OLDNEW
« no previous file with comments | « chrome/browser/custom_handlers/custom_handlers_uitest.cc ('k') | chrome/browser/infobars/infobars_uitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698