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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 SocketsUdpApiTest() : resolver_event_(true, false), | 42 SocketsUdpApiTest() : resolver_event_(true, false), |
43 resolver_creator_( | 43 resolver_creator_( |
44 new extensions::MockHostResolverCreator()) { | 44 new extensions::MockHostResolverCreator()) { |
45 } | 45 } |
46 | 46 |
47 virtual void SetUpOnMainThread() OVERRIDE { | 47 virtual void SetUpOnMainThread() OVERRIDE { |
48 extensions::HostResolverWrapper::GetInstance()->SetHostResolverForTesting( | 48 extensions::HostResolverWrapper::GetInstance()->SetHostResolverForTesting( |
49 resolver_creator_->CreateMockHostResolver()); | 49 resolver_creator_->CreateMockHostResolver()); |
50 } | 50 } |
51 | 51 |
52 virtual void CleanUpOnMainThread() OVERRIDE { | 52 virtual void TearDownOnMainThread() OVERRIDE { |
53 extensions::HostResolverWrapper::GetInstance()-> | 53 extensions::HostResolverWrapper::GetInstance()-> |
54 SetHostResolverForTesting(NULL); | 54 SetHostResolverForTesting(NULL); |
55 resolver_creator_->DeleteMockHostResolver(); | 55 resolver_creator_->DeleteMockHostResolver(); |
56 } | 56 } |
57 | 57 |
58 private: | 58 private: |
59 base::WaitableEvent resolver_event_; | 59 base::WaitableEvent resolver_event_; |
60 | 60 |
61 // The MockHostResolver asserts that it's used on the same thread on which | 61 // The MockHostResolver asserts that it's used on the same thread on which |
62 // it's created, which is actually a stronger rule than its real counterpart. | 62 // it's created, which is actually a stronger rule than its real counterpart. |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 ResultCatcher catcher; | 117 ResultCatcher catcher; |
118 catcher.RestrictToProfile(browser()->profile()); | 118 catcher.RestrictToProfile(browser()->profile()); |
119 ExtensionTestMessageListener listener("info_please", true); | 119 ExtensionTestMessageListener listener("info_please", true); |
120 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("sockets_udp/api"))); | 120 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("sockets_udp/api"))); |
121 EXPECT_TRUE(listener.WaitUntilSatisfied()); | 121 EXPECT_TRUE(listener.WaitUntilSatisfied()); |
122 listener.Reply( | 122 listener.Reply( |
123 base::StringPrintf("multicast:%s:%d", kHostname.c_str(), kPort)); | 123 base::StringPrintf("multicast:%s:%d", kHostname.c_str(), kPort)); |
124 | 124 |
125 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); | 125 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); |
126 } | 126 } |
OLD | NEW |