| OLD | NEW |
| 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 <utility> | 5 #include <utility> |
| 6 | 6 |
| 7 #include "base/memory/ref_counted.h" | 7 #include "base/memory/ref_counted.h" |
| 8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
| 9 #include "extensions/browser/api/dns/host_resolver_wrapper.h" | 9 #include "extensions/browser/api/dns/host_resolver_wrapper.h" |
| 10 #include "extensions/browser/api/dns/mock_host_resolver_creator.h" | 10 #include "extensions/browser/api/dns/mock_host_resolver_creator.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 new api::SocketsTcpCreateFunction()); | 58 new api::SocketsTcpCreateFunction()); |
| 59 scoped_refptr<Extension> empty_extension = test_util::CreateEmptyExtension(); | 59 scoped_refptr<Extension> empty_extension = test_util::CreateEmptyExtension(); |
| 60 | 60 |
| 61 socket_create_function->set_extension(empty_extension.get()); | 61 socket_create_function->set_extension(empty_extension.get()); |
| 62 socket_create_function->set_has_callback(true); | 62 socket_create_function->set_has_callback(true); |
| 63 | 63 |
| 64 std::unique_ptr<base::Value> result( | 64 std::unique_ptr<base::Value> result( |
| 65 api_test_utils::RunFunctionAndReturnSingleResult( | 65 api_test_utils::RunFunctionAndReturnSingleResult( |
| 66 socket_create_function.get(), "[]", browser_context())); | 66 socket_create_function.get(), "[]", browser_context())); |
| 67 | 67 |
| 68 ASSERT_EQ(base::Value::TYPE_DICTIONARY, result->GetType()); | 68 ASSERT_EQ(base::Value::Type::DICTIONARY, result->GetType()); |
| 69 std::unique_ptr<base::DictionaryValue> value = | 69 std::unique_ptr<base::DictionaryValue> value = |
| 70 base::DictionaryValue::From(std::move(result)); | 70 base::DictionaryValue::From(std::move(result)); |
| 71 int socketId = -1; | 71 int socketId = -1; |
| 72 EXPECT_TRUE(value->GetInteger("socketId", &socketId)); | 72 EXPECT_TRUE(value->GetInteger("socketId", &socketId)); |
| 73 ASSERT_TRUE(socketId > 0); | 73 ASSERT_TRUE(socketId > 0); |
| 74 } | 74 } |
| 75 | 75 |
| 76 IN_PROC_BROWSER_TEST_F(SocketsTcpApiTest, SocketTcpExtension) { | 76 IN_PROC_BROWSER_TEST_F(SocketsTcpApiTest, SocketTcpExtension) { |
| 77 std::unique_ptr<net::SpawnedTestServer> test_server( | 77 std::unique_ptr<net::SpawnedTestServer> test_server( |
| 78 new net::SpawnedTestServer( | 78 new net::SpawnedTestServer( |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 | 119 |
| 120 ASSERT_TRUE(LoadApp("sockets_tcp/api")); | 120 ASSERT_TRUE(LoadApp("sockets_tcp/api")); |
| 121 EXPECT_TRUE(listener.WaitUntilSatisfied()); | 121 EXPECT_TRUE(listener.WaitUntilSatisfied()); |
| 122 listener.Reply(base::StringPrintf( | 122 listener.Reply(base::StringPrintf( |
| 123 "https:%s:%d", https_host_port_pair.host().c_str(), https_port)); | 123 "https:%s:%d", https_host_port_pair.host().c_str(), https_port)); |
| 124 | 124 |
| 125 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); | 125 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); |
| 126 } | 126 } |
| 127 | 127 |
| 128 } // namespace extensions | 128 } // namespace extensions |
| OLD | NEW |