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/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_server/sockets_tcp_server_api.h" | 9 #include "extensions/browser/api/sockets_tcp_server/sockets_tcp_server_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(SocketsTcpServerApiTest, SocketTCPCreateGood) { | 53 IN_PROC_BROWSER_TEST_F(SocketsTcpServerApiTest, SocketTCPCreateGood) { |
54 scoped_refptr<core_api::SocketsTcpServerCreateFunction> | 54 scoped_refptr<api::SocketsTcpServerCreateFunction> socket_create_function( |
55 socket_create_function(new core_api::SocketsTcpServerCreateFunction()); | 55 new api::SocketsTcpServerCreateFunction()); |
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 ASSERT_EQ(base::Value::TYPE_DICTIONARY, result->GetType()); | 64 ASSERT_EQ(base::Value::TYPE_DICTIONARY, result->GetType()); |
65 base::DictionaryValue* value = | 65 base::DictionaryValue* value = |
(...skipping 22 matching lines...) Expand all Loading... |
88 ASSERT_TRUE(extension); | 88 ASSERT_TRUE(extension); |
89 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); | 89 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); |
90 | 90 |
91 UnloadApp(extension); | 91 UnloadApp(extension); |
92 | 92 |
93 ASSERT_TRUE(LoadApp(path)) << message_; | 93 ASSERT_TRUE(LoadApp(path)) << message_; |
94 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); | 94 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); |
95 } | 95 } |
96 | 96 |
97 } // namespace extensions | 97 } // namespace extensions |
OLD | NEW |