| 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/api/dns/mock_host_resolver_creator.h" | 8 #include "chrome/browser/extensions/api/dns/mock_host_resolver_creator.h" |
| 9 #include "chrome/browser/extensions/extension_apitest.h" | 9 #include "chrome/browser/extensions/extension_apitest.h" |
| 10 #include "chrome/browser/extensions/extension_function_test_utils.h" | 10 #include "chrome/browser/extensions/extension_function_test_utils.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 SocketsTcpApiTest() : resolver_event_(true, false), | 40 SocketsTcpApiTest() : resolver_event_(true, false), |
| 41 resolver_creator_( | 41 resolver_creator_( |
| 42 new extensions::MockHostResolverCreator()) { | 42 new extensions::MockHostResolverCreator()) { |
| 43 } | 43 } |
| 44 | 44 |
| 45 virtual void SetUpOnMainThread() OVERRIDE { | 45 virtual void SetUpOnMainThread() OVERRIDE { |
| 46 extensions::HostResolverWrapper::GetInstance()->SetHostResolverForTesting( | 46 extensions::HostResolverWrapper::GetInstance()->SetHostResolverForTesting( |
| 47 resolver_creator_->CreateMockHostResolver()); | 47 resolver_creator_->CreateMockHostResolver()); |
| 48 } | 48 } |
| 49 | 49 |
| 50 virtual void CleanUpOnMainThread() OVERRIDE { | 50 virtual void TearDownOnMainThread() OVERRIDE { |
| 51 extensions::HostResolverWrapper::GetInstance()-> | 51 extensions::HostResolverWrapper::GetInstance()-> |
| 52 SetHostResolverForTesting(NULL); | 52 SetHostResolverForTesting(NULL); |
| 53 resolver_creator_->DeleteMockHostResolver(); | 53 resolver_creator_->DeleteMockHostResolver(); |
| 54 } | 54 } |
| 55 | 55 |
| 56 private: | 56 private: |
| 57 base::WaitableEvent resolver_event_; | 57 base::WaitableEvent resolver_event_; |
| 58 | 58 |
| 59 // The MockHostResolver asserts that it's used on the same thread on which | 59 // The MockHostResolver asserts that it's used on the same thread on which |
| 60 // it's created, which is actually a stronger rule than its real counterpart. | 60 // it's created, which is actually a stronger rule than its real counterpart. |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 | 103 |
| 104 ExtensionTestMessageListener listener("info_please", true); | 104 ExtensionTestMessageListener listener("info_please", true); |
| 105 | 105 |
| 106 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("sockets_tcp/api"))); | 106 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("sockets_tcp/api"))); |
| 107 EXPECT_TRUE(listener.WaitUntilSatisfied()); | 107 EXPECT_TRUE(listener.WaitUntilSatisfied()); |
| 108 listener.Reply( | 108 listener.Reply( |
| 109 base::StringPrintf("tcp:%s:%d", host_port_pair.host().c_str(), port)); | 109 base::StringPrintf("tcp:%s:%d", host_port_pair.host().c_str(), port)); |
| 110 | 110 |
| 111 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); | 111 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); |
| 112 } | 112 } |
| OLD | NEW |