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_udp/sockets_udp_api.h" | 9 #include "extensions/browser/api/sockets_udp/sockets_udp_api.h" |
10 #include "extensions/browser/api_test_utils.h" | 10 #include "extensions/browser/api_test_utils.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 private: | 45 private: |
46 base::WaitableEvent resolver_event_; | 46 base::WaitableEvent resolver_event_; |
47 | 47 |
48 // The MockHostResolver asserts that it's used on the same thread on which | 48 // The MockHostResolver asserts that it's used on the same thread on which |
49 // it's created, which is actually a stronger rule than its real counterpart. | 49 // it's created, which is actually a stronger rule than its real counterpart. |
50 // But that's fine; it's good practice. | 50 // But that's fine; it's good practice. |
51 scoped_refptr<MockHostResolverCreator> resolver_creator_; | 51 scoped_refptr<MockHostResolverCreator> resolver_creator_; |
52 }; | 52 }; |
53 | 53 |
54 IN_PROC_BROWSER_TEST_F(SocketsUdpApiTest, SocketsUdpCreateGood) { | 54 IN_PROC_BROWSER_TEST_F(SocketsUdpApiTest, SocketsUdpCreateGood) { |
55 scoped_refptr<core_api::SocketsUdpCreateFunction> socket_create_function( | 55 scoped_refptr<api::SocketsUdpCreateFunction> socket_create_function( |
56 new core_api::SocketsUdpCreateFunction()); | 56 new api::SocketsUdpCreateFunction()); |
57 scoped_refptr<Extension> empty_extension = test_util::CreateEmptyExtension(); | 57 scoped_refptr<Extension> empty_extension = test_util::CreateEmptyExtension(); |
58 | 58 |
59 socket_create_function->set_extension(empty_extension.get()); | 59 socket_create_function->set_extension(empty_extension.get()); |
60 socket_create_function->set_has_callback(true); | 60 socket_create_function->set_has_callback(true); |
61 | 61 |
62 scoped_ptr<base::Value> result( | 62 scoped_ptr<base::Value> result( |
63 api_test_utils::RunFunctionAndReturnSingleResult( | 63 api_test_utils::RunFunctionAndReturnSingleResult( |
64 socket_create_function.get(), "[]", browser_context())); | 64 socket_create_function.get(), "[]", browser_context())); |
65 | 65 |
66 base::DictionaryValue* value = NULL; | 66 base::DictionaryValue* value = NULL; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 ExtensionTestMessageListener listener("info_please", true); | 103 ExtensionTestMessageListener listener("info_please", true); |
104 ASSERT_TRUE(LoadApp("sockets_udp/api")); | 104 ASSERT_TRUE(LoadApp("sockets_udp/api")); |
105 EXPECT_TRUE(listener.WaitUntilSatisfied()); | 105 EXPECT_TRUE(listener.WaitUntilSatisfied()); |
106 listener.Reply( | 106 listener.Reply( |
107 base::StringPrintf("multicast:%s:%d", kHostname.c_str(), kPort)); | 107 base::StringPrintf("multicast:%s:%d", kHostname.c_str(), kPort)); |
108 | 108 |
109 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); | 109 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); |
110 } | 110 } |
111 | 111 |
112 } // namespace extensions | 112 } // namespace extensions |
OLD | NEW |