OLD | NEW |
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/path_service.h" | 6 #include "base/path_service.h" |
7 #include "base/strings/stringprintf.h" | 7 #include "base/strings/stringprintf.h" |
8 #include "chrome/browser/extensions/extension_apitest.h" | 8 #include "chrome/browser/extensions/extension_apitest.h" |
9 #include "chrome/browser/extensions/extension_function_test_utils.h" | 9 #include "chrome/browser/extensions/extension_function_test_utils.h" |
10 #include "chrome/browser/extensions/extension_service.h" | 10 #include "chrome/browser/extensions/extension_service.h" |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 | 103 |
104 ExtensionTestMessageListener listener("info_please", true); | 104 ExtensionTestMessageListener listener("info_please", true); |
105 | 105 |
106 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("sockets_tcp/api"))); | 106 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("sockets_tcp/api"))); |
107 EXPECT_TRUE(listener.WaitUntilSatisfied()); | 107 EXPECT_TRUE(listener.WaitUntilSatisfied()); |
108 listener.Reply( | 108 listener.Reply( |
109 base::StringPrintf("tcp:%s:%d", host_port_pair.host().c_str(), port)); | 109 base::StringPrintf("tcp:%s:%d", host_port_pair.host().c_str(), port)); |
110 | 110 |
111 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); | 111 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); |
112 } | 112 } |
| 113 |
| 114 IN_PROC_BROWSER_TEST_F(SocketsTcpApiTest, SocketTcpExtensionTLS) { |
| 115 scoped_ptr<net::SpawnedTestServer> test_https_server( |
| 116 new net::SpawnedTestServer( |
| 117 net::SpawnedTestServer::TYPE_HTTPS, |
| 118 net::BaseTestServer::SSLOptions(), |
| 119 base::FilePath(FILE_PATH_LITERAL("net/data")))); |
| 120 EXPECT_TRUE(test_https_server->Start()); |
| 121 |
| 122 net::HostPortPair https_host_port_pair = test_https_server->host_port_pair(); |
| 123 int https_port = https_host_port_pair.port(); |
| 124 ASSERT_GT(https_port, 0); |
| 125 |
| 126 ResultCatcher catcher; |
| 127 catcher.RestrictToProfile(browser()->profile()); |
| 128 |
| 129 ExtensionTestMessageListener listener("info_please", true); |
| 130 |
| 131 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("sockets_tcp/api"))); |
| 132 EXPECT_TRUE(listener.WaitUntilSatisfied()); |
| 133 listener.Reply(base::StringPrintf( |
| 134 "https:%s:%d", https_host_port_pair.host().c_str(), https_port)); |
| 135 |
| 136 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); |
| 137 } |
OLD | NEW |