OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "base/synchronization/waitable_event.h" | 5 #include "base/synchronization/waitable_event.h" |
6 #include "base/threading/thread.h" | 6 #include "base/threading/thread.h" |
7 #include "net/test/spawned_test_server/spawned_test_server.h" | 7 #include "net/test/spawned_test_server/spawned_test_server.h" |
8 #include "net/url_request/test_url_fetcher_factory.h" | 8 #include "net/url_request/test_url_fetcher_factory.h" |
9 #include "net/url_request/url_fetcher_delegate.h" | 9 #include "net/url_request/url_fetcher_delegate.h" |
10 #include "net/url_request/url_request_test_util.h" | 10 #include "net/url_request/url_request_test_util.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 public: | 24 public: |
25 SyncHttpBridgeTest() | 25 SyncHttpBridgeTest() |
26 : test_server_(net::SpawnedTestServer::TYPE_HTTP, | 26 : test_server_(net::SpawnedTestServer::TYPE_HTTP, |
27 net::SpawnedTestServer::kLocalhost, | 27 net::SpawnedTestServer::kLocalhost, |
28 base::FilePath(kDocRoot)), | 28 base::FilePath(kDocRoot)), |
29 fake_default_request_context_getter_(NULL), | 29 fake_default_request_context_getter_(NULL), |
30 bridge_for_race_test_(NULL), | 30 bridge_for_race_test_(NULL), |
31 io_thread_("IO thread") { | 31 io_thread_("IO thread") { |
32 } | 32 } |
33 | 33 |
34 virtual void SetUp() { | 34 void SetUp() override { |
35 base::Thread::Options options; | 35 base::Thread::Options options; |
36 options.message_loop_type = base::MessageLoop::TYPE_IO; | 36 options.message_loop_type = base::MessageLoop::TYPE_IO; |
37 io_thread_.StartWithOptions(options); | 37 io_thread_.StartWithOptions(options); |
38 } | 38 } |
39 | 39 |
40 virtual void TearDown() { | 40 void TearDown() override { |
41 if (fake_default_request_context_getter_) { | 41 if (fake_default_request_context_getter_) { |
42 GetIOThreadLoop()->ReleaseSoon(FROM_HERE, | 42 GetIOThreadLoop()->ReleaseSoon(FROM_HERE, |
43 fake_default_request_context_getter_); | 43 fake_default_request_context_getter_); |
44 fake_default_request_context_getter_ = NULL; | 44 fake_default_request_context_getter_ = NULL; |
45 } | 45 } |
46 io_thread_.Stop(); | 46 io_thread_.Stop(); |
47 } | 47 } |
48 | 48 |
49 HttpBridge* BuildBridge() { | 49 HttpBridge* BuildBridge() { |
50 if (!fake_default_request_context_getter_) { | 50 if (!fake_default_request_context_getter_) { |
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
508 | 508 |
509 // Sync thread: Finally run the posted task, only to find that our | 509 // Sync thread: Finally run the posted task, only to find that our |
510 // HttpBridgeFactory has been neutered. Should not crash. | 510 // HttpBridgeFactory has been neutered. Should not crash. |
511 factory->Init("TestUserAgent"); | 511 factory->Init("TestUserAgent"); |
512 | 512 |
513 // At this point, attempting to use the factory would trigger a crash. Both | 513 // At this point, attempting to use the factory would trigger a crash. Both |
514 // this test and the real world code should make sure this never happens. | 514 // this test and the real world code should make sure this never happens. |
515 }; | 515 }; |
516 | 516 |
517 } // namespace syncer | 517 } // namespace syncer |
OLD | NEW |