Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Side by Side Diff: net/test/embedded_test_server/embedded_test_server_unittest.cc

Issue 669813003: Update from chromium https://crrev.com/301725/ (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/ssl/ssl_config_service.cc ('k') | net/test/run_all_unittests.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "net/test/embedded_test_server/embedded_test_server.h" 5 #include "net/test/embedded_test_server/embedded_test_server.h"
6 6
7 #include "base/strings/stringprintf.h" 7 #include "base/strings/stringprintf.h"
8 #include "base/threading/thread.h" 8 #include "base/threading/thread.h"
9 #include "net/http/http_response_headers.h" 9 #include "net/http/http_response_headers.h"
10 #include "net/test/embedded_test_server/http_request.h" 10 #include "net/test/embedded_test_server/http_request.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 42
43 class EmbeddedTestServerTest: public testing::Test, 43 class EmbeddedTestServerTest: public testing::Test,
44 public URLFetcherDelegate { 44 public URLFetcherDelegate {
45 public: 45 public:
46 EmbeddedTestServerTest() 46 EmbeddedTestServerTest()
47 : num_responses_received_(0), 47 : num_responses_received_(0),
48 num_responses_expected_(0), 48 num_responses_expected_(0),
49 io_thread_("io_thread") { 49 io_thread_("io_thread") {
50 } 50 }
51 51
52 virtual void SetUp() override { 52 void SetUp() override {
53 base::Thread::Options thread_options; 53 base::Thread::Options thread_options;
54 thread_options.message_loop_type = base::MessageLoop::TYPE_IO; 54 thread_options.message_loop_type = base::MessageLoop::TYPE_IO;
55 ASSERT_TRUE(io_thread_.StartWithOptions(thread_options)); 55 ASSERT_TRUE(io_thread_.StartWithOptions(thread_options));
56 56
57 request_context_getter_ = new TestURLRequestContextGetter( 57 request_context_getter_ = new TestURLRequestContextGetter(
58 io_thread_.message_loop_proxy()); 58 io_thread_.message_loop_proxy());
59 59
60 server_.reset(new EmbeddedTestServer); 60 server_.reset(new EmbeddedTestServer);
61 ASSERT_TRUE(server_->InitializeAndWaitUntilReady()); 61 ASSERT_TRUE(server_->InitializeAndWaitUntilReady());
62 } 62 }
63 63
64 virtual void TearDown() override { 64 void TearDown() override {
65 ASSERT_TRUE(server_->ShutdownAndWaitUntilComplete()); 65 ASSERT_TRUE(server_->ShutdownAndWaitUntilComplete());
66 } 66 }
67 67
68 // URLFetcherDelegate override. 68 // URLFetcherDelegate override.
69 void OnURLFetchComplete(const URLFetcher* source) override { 69 void OnURLFetchComplete(const URLFetcher* source) override {
70 ++num_responses_received_; 70 ++num_responses_received_;
71 if (num_responses_received_ == num_responses_expected_) 71 if (num_responses_received_ == num_responses_expected_)
72 base::MessageLoop::current()->Quit(); 72 base::MessageLoop::current()->Quit();
73 } 73 }
74 74
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 ASSERT_TRUE(base::PlatformThread::Create(0, &delegate, &thread_handle)); 320 ASSERT_TRUE(base::PlatformThread::Create(0, &delegate, &thread_handle));
321 base::PlatformThread::Join(thread_handle); 321 base::PlatformThread::Join(thread_handle);
322 } 322 }
323 323
324 INSTANTIATE_TEST_CASE_P(EmbeddedTestServerThreadingTestInstantiation, 324 INSTANTIATE_TEST_CASE_P(EmbeddedTestServerThreadingTestInstantiation,
325 EmbeddedTestServerThreadingTest, 325 EmbeddedTestServerThreadingTest,
326 testing::Combine(testing::Bool(), testing::Bool())); 326 testing::Combine(testing::Bool(), testing::Bool()));
327 327
328 } // namespace test_server 328 } // namespace test_server
329 } // namespace net 329 } // namespace net
OLDNEW
« no previous file with comments | « net/ssl/ssl_config_service.cc ('k') | net/test/run_all_unittests.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698