| 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 "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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 private: | 44 private: |
| 45 base::WaitableEvent resolver_event_; | 45 base::WaitableEvent resolver_event_; |
| 46 | 46 |
| 47 // The MockHostResolver asserts that it's used on the same thread on which | 47 // The MockHostResolver asserts that it's used on the same thread on which |
| 48 // it's created, which is actually a stronger rule than its real counterpart. | 48 // it's created, which is actually a stronger rule than its real counterpart. |
| 49 // But that's fine; it's good practice. | 49 // But that's fine; it's good practice. |
| 50 scoped_refptr<MockHostResolverCreator> resolver_creator_; | 50 scoped_refptr<MockHostResolverCreator> resolver_creator_; |
| 51 }; | 51 }; |
| 52 | 52 |
| 53 IN_PROC_BROWSER_TEST_F(SocketsTcpApiTest, SocketsTcpCreateGood) { | 53 IN_PROC_BROWSER_TEST_F(SocketsTcpApiTest, SocketsTcpCreateGood) { |
| 54 scoped_refptr<core_api::SocketsTcpCreateFunction> socket_create_function( | 54 scoped_refptr<api::SocketsTcpCreateFunction> socket_create_function( |
| 55 new core_api::SocketsTcpCreateFunction()); | 55 new api::SocketsTcpCreateFunction()); |
| 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()); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 |
| OLD | NEW |