| 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 28 matching lines...) Expand all Loading... |
| 39 const std::string kHostname = "127.0.0.1"; | 39 const std::string kHostname = "127.0.0.1"; |
| 40 const int kPort = 8888; | 40 const int kPort = 8888; |
| 41 | 41 |
| 42 class SocketsTcpServerApiTest : public ExtensionApiTest { | 42 class SocketsTcpServerApiTest : public ExtensionApiTest { |
| 43 public: | 43 public: |
| 44 SocketsTcpServerApiTest() : resolver_event_(true, false), | 44 SocketsTcpServerApiTest() : resolver_event_(true, false), |
| 45 resolver_creator_( | 45 resolver_creator_( |
| 46 new extensions::MockHostResolverCreator()) { | 46 new extensions::MockHostResolverCreator()) { |
| 47 } | 47 } |
| 48 | 48 |
| 49 virtual void SetUpOnMainThread() OVERRIDE { | 49 virtual void SetUpOnMainThread() override { |
| 50 extensions::HostResolverWrapper::GetInstance()->SetHostResolverForTesting( | 50 extensions::HostResolverWrapper::GetInstance()->SetHostResolverForTesting( |
| 51 resolver_creator_->CreateMockHostResolver()); | 51 resolver_creator_->CreateMockHostResolver()); |
| 52 } | 52 } |
| 53 | 53 |
| 54 virtual void TearDownOnMainThread() OVERRIDE { | 54 virtual void TearDownOnMainThread() override { |
| 55 extensions::HostResolverWrapper::GetInstance()-> | 55 extensions::HostResolverWrapper::GetInstance()-> |
| 56 SetHostResolverForTesting(NULL); | 56 SetHostResolverForTesting(NULL); |
| 57 resolver_creator_->DeleteMockHostResolver(); | 57 resolver_creator_->DeleteMockHostResolver(); |
| 58 } | 58 } |
| 59 | 59 |
| 60 private: | 60 private: |
| 61 base::WaitableEvent resolver_event_; | 61 base::WaitableEvent resolver_event_; |
| 62 | 62 |
| 63 // The MockHostResolver asserts that it's used on the same thread on which | 63 // The MockHostResolver asserts that it's used on the same thread on which |
| 64 // it's created, which is actually a stronger rule than its real counterpart. | 64 // it's created, which is actually a stronger rule than its real counterpart. |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 extensions::ResultCatcher catcher; | 105 extensions::ResultCatcher catcher; |
| 106 const Extension* extension = LoadExtension(path); | 106 const Extension* extension = LoadExtension(path); |
| 107 ASSERT_TRUE(extension); | 107 ASSERT_TRUE(extension); |
| 108 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); | 108 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); |
| 109 | 109 |
| 110 UnloadExtension(extension->id()); | 110 UnloadExtension(extension->id()); |
| 111 | 111 |
| 112 ASSERT_TRUE(LoadExtension(path)) << message_; | 112 ASSERT_TRUE(LoadExtension(path)) << message_; |
| 113 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); | 113 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); |
| 114 } | 114 } |
| OLD | NEW |