OLD | NEW |
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/memory/ref_counted.h" | 5 #include "base/memory/ref_counted.h" |
6 #include "base/stringprintf.h" | 6 #include "base/stringprintf.h" |
7 #include "chrome/browser/extensions/api/dns/host_resolver_wrapper.h" | 7 #include "chrome/browser/extensions/api/dns/host_resolver_wrapper.h" |
8 #include "chrome/browser/extensions/api/dns/mock_host_resolver_creator.h" | 8 #include "chrome/browser/extensions/api/dns/mock_host_resolver_creator.h" |
9 #include "chrome/browser/extensions/api/socket/socket_api.h" | 9 #include "chrome/browser/extensions/api/socket/socket_api.h" |
10 #include "chrome/browser/extensions/extension_apitest.h" | 10 #include "chrome/browser/extensions/extension_apitest.h" |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 | 157 |
158 ExtensionTestMessageListener listener("info_please", true); | 158 ExtensionTestMessageListener listener("info_please", true); |
159 | 159 |
160 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("socket/api"))); | 160 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("socket/api"))); |
161 EXPECT_TRUE(listener.WaitUntilSatisfied()); | 161 EXPECT_TRUE(listener.WaitUntilSatisfied()); |
162 listener.Reply( | 162 listener.Reply( |
163 base::StringPrintf("tcp:%s:%d", host_port_pair.host().c_str(), port)); | 163 base::StringPrintf("tcp:%s:%d", host_port_pair.host().c_str(), port)); |
164 | 164 |
165 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); | 165 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); |
166 } | 166 } |
| 167 |
| 168 IN_PROC_BROWSER_TEST_F(SocketApiTest, SocketTCPServerExtension) { |
| 169 ResultCatcher catcher; |
| 170 catcher.RestrictToProfile(browser()->profile()); |
| 171 ExtensionTestMessageListener listener("info_please", true); |
| 172 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("socket/api"))); |
| 173 EXPECT_TRUE(listener.WaitUntilSatisfied()); |
| 174 listener.Reply( |
| 175 base::StringPrintf("tcp_server:%s:%d", kHostname.c_str(), kPort)); |
| 176 |
| 177 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); |
| 178 } |
| 179 |
| 180 IN_PROC_BROWSER_TEST_F(SocketApiTest, SocketExperimentalPermissionTest) { |
| 181 ResultCatcher catcher; |
| 182 catcher.RestrictToProfile(browser()->profile()); |
| 183 |
| 184 ExtensionTestMessageListener listener("ready", true); |
| 185 |
| 186 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("socket/experimental"))); |
| 187 EXPECT_TRUE(listener.WaitUntilSatisfied()); |
| 188 listener.Reply("go"); |
| 189 |
| 190 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); |
| 191 } |
OLD | NEW |