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_service.h" | 9 #include "chrome/browser/extensions/extension_service.h" |
10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 | 31 |
32 const std::string kHostname = "127.0.0.1"; | 32 const std::string kHostname = "127.0.0.1"; |
33 | 33 |
34 class SocketsTcpApiTest : public ExtensionApiTest { | 34 class SocketsTcpApiTest : public ExtensionApiTest { |
35 public: | 35 public: |
36 SocketsTcpApiTest() : resolver_event_(true, false), | 36 SocketsTcpApiTest() : resolver_event_(true, false), |
37 resolver_creator_( | 37 resolver_creator_( |
38 new extensions::MockHostResolverCreator()) { | 38 new extensions::MockHostResolverCreator()) { |
39 } | 39 } |
40 | 40 |
41 virtual void SetUpOnMainThread() OVERRIDE { | 41 virtual void SetUpOnMainThread() override { |
42 extensions::HostResolverWrapper::GetInstance()->SetHostResolverForTesting( | 42 extensions::HostResolverWrapper::GetInstance()->SetHostResolverForTesting( |
43 resolver_creator_->CreateMockHostResolver()); | 43 resolver_creator_->CreateMockHostResolver()); |
44 } | 44 } |
45 | 45 |
46 virtual void TearDownOnMainThread() OVERRIDE { | 46 virtual void TearDownOnMainThread() override { |
47 extensions::HostResolverWrapper::GetInstance()-> | 47 extensions::HostResolverWrapper::GetInstance()-> |
48 SetHostResolverForTesting(NULL); | 48 SetHostResolverForTesting(NULL); |
49 resolver_creator_->DeleteMockHostResolver(); | 49 resolver_creator_->DeleteMockHostResolver(); |
50 } | 50 } |
51 | 51 |
52 private: | 52 private: |
53 base::WaitableEvent resolver_event_; | 53 base::WaitableEvent resolver_event_; |
54 | 54 |
55 // The MockHostResolver asserts that it's used on the same thread on which | 55 // The MockHostResolver asserts that it's used on the same thread on which |
56 // it's created, which is actually a stronger rule than its real counterpart. | 56 // it's created, which is actually a stronger rule than its real counterpart. |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 | 105 |
106 ExtensionTestMessageListener listener("info_please", true); | 106 ExtensionTestMessageListener listener("info_please", true); |
107 | 107 |
108 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("sockets_tcp/api"))); | 108 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("sockets_tcp/api"))); |
109 EXPECT_TRUE(listener.WaitUntilSatisfied()); | 109 EXPECT_TRUE(listener.WaitUntilSatisfied()); |
110 listener.Reply(base::StringPrintf( | 110 listener.Reply(base::StringPrintf( |
111 "https:%s:%d", https_host_port_pair.host().c_str(), https_port)); | 111 "https:%s:%d", https_host_port_pair.host().c_str(), https_port)); |
112 | 112 |
113 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); | 113 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); |
114 } | 114 } |
OLD | NEW |