| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 SocketsTcpServerApiTest() : resolver_event_(true, false), | 42 SocketsTcpServerApiTest() : 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 ResultCatcher catcher; | 102 ResultCatcher catcher; |
| 103 const Extension* extension = LoadExtension(path); | 103 const Extension* extension = LoadExtension(path); |
| 104 ASSERT_TRUE(extension); | 104 ASSERT_TRUE(extension); |
| 105 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); | 105 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); |
| 106 | 106 |
| 107 UnloadExtension(extension->id()); | 107 UnloadExtension(extension->id()); |
| 108 | 108 |
| 109 ASSERT_TRUE(LoadExtension(path)) << message_; | 109 ASSERT_TRUE(LoadExtension(path)) << message_; |
| 110 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); | 110 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); |
| 111 } | 111 } |
| OLD | NEW |