OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 "chrome/browser/io_thread.h" | 5 #include "chrome/browser/io_thread.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 | 66 |
67 void SetUp() override { | 67 void SetUp() override { |
68 // Must start listening (And get a port for the proxy) before calling | 68 // Must start listening (And get a port for the proxy) before calling |
69 // SetUp(). Use two phase EmbeddedTestServer setup for proxy tests. | 69 // SetUp(). Use two phase EmbeddedTestServer setup for proxy tests. |
70 ASSERT_TRUE(embedded_test_server()->InitializeAndListen()); | 70 ASSERT_TRUE(embedded_test_server()->InitializeAndListen()); |
71 InProcessBrowserTest::SetUp(); | 71 InProcessBrowserTest::SetUp(); |
72 } | 72 } |
73 | 73 |
74 void SetUpOnMainThread() override { | 74 void SetUpOnMainThread() override { |
75 embedded_test_server()->StartAcceptingConnections(); | 75 embedded_test_server()->StartAcceptingConnections(); |
76 | |
77 InProcessBrowserTest::SetUpOnMainThread(); | |
78 } | 76 } |
79 | 77 |
80 void TearDown() override { | 78 void TearDown() override { |
81 // Need to stop this before |connection_listener_| is destroyed. | 79 // Need to stop this before |connection_listener_| is destroyed. |
82 EXPECT_TRUE(embedded_test_server()->ShutdownAndWaitUntilComplete()); | 80 EXPECT_TRUE(embedded_test_server()->ShutdownAndWaitUntilComplete()); |
83 InProcessBrowserTest::TearDown(); | 81 InProcessBrowserTest::TearDown(); |
84 } | 82 } |
85 }; | 83 }; |
86 | 84 |
87 // Make sure that the system URLRequestContext does not cache responses. Main | 85 // Make sure that the system URLRequestContext does not cache responses. Main |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 g_browser_process->io_thread()->system_url_request_context_getter()); | 196 g_browser_process->io_thread()->system_url_request_context_getter()); |
199 fetcher->Start(); | 197 fetcher->Start(); |
200 fetcher_delegate.WaitForCompletion(); | 198 fetcher_delegate.WaitForCompletion(); |
201 EXPECT_EQ(200, fetcher->GetResponseCode()); | 199 EXPECT_EQ(200, fetcher->GetResponseCode()); |
202 std::string response; | 200 std::string response; |
203 ASSERT_TRUE(fetcher->GetResponseAsString(&response)); | 201 ASSERT_TRUE(fetcher->GetResponseAsString(&response)); |
204 EXPECT_EQ("Bar", response); | 202 EXPECT_EQ("Bar", response); |
205 } | 203 } |
206 | 204 |
207 } // namespace | 205 } // namespace |
OLD | NEW |