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/metrics/field_trial.h" | 5 #include "base/metrics/field_trial.h" |
6 #include "base/strings/stringprintf.h" | 6 #include "base/strings/stringprintf.h" |
7 #include "base/synchronization/waitable_event.h" | 7 #include "base/synchronization/waitable_event.h" |
8 #include "base/test/mock_entropy_provider.h" | 8 #include "base/test/mock_entropy_provider.h" |
9 #include "base/threading/thread.h" | 9 #include "base/threading/thread.h" |
10 #include "net/http/http_response_headers.h" | 10 #include "net/http/http_response_headers.h" |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 MAYBE_SyncHttpBridgeTest* test) { | 163 MAYBE_SyncHttpBridgeTest* test) { |
164 scoped_refptr<HttpBridge> http_bridge(test->BuildBridge()); | 164 scoped_refptr<HttpBridge> http_bridge(test->BuildBridge()); |
165 EXPECT_TRUE(test->GetTestRequestContextGetter()); | 165 EXPECT_TRUE(test->GetTestRequestContextGetter()); |
166 net::HttpNetworkSession* test_session = | 166 net::HttpNetworkSession* test_session = |
167 test->GetTestRequestContextGetter()->GetURLRequestContext()-> | 167 test->GetTestRequestContextGetter()->GetURLRequestContext()-> |
168 http_transaction_factory()->GetSession(); | 168 http_transaction_factory()->GetSession(); |
169 EXPECT_EQ(test_session, | 169 EXPECT_EQ(test_session, |
170 http_bridge->GetRequestContextGetterForTest()-> | 170 http_bridge->GetRequestContextGetterForTest()-> |
171 GetURLRequestContext()-> | 171 GetURLRequestContext()-> |
172 http_transaction_factory()->GetSession()); | 172 http_transaction_factory()->GetSession()); |
173 main_message_loop->PostTask(FROM_HERE, base::MessageLoop::QuitClosure()); | 173 main_message_loop->PostTask(FROM_HERE, |
| 174 base::MessageLoop::QuitWhenIdleClosure()); |
174 } | 175 } |
175 | 176 |
176 base::MessageLoop* GetIOThreadLoop() { return io_thread_.message_loop(); } | 177 base::MessageLoop* GetIOThreadLoop() { return io_thread_.message_loop(); } |
177 | 178 |
178 // Note this is lazy created, so don't call this before your bridge. | 179 // Note this is lazy created, so don't call this before your bridge. |
179 net::TestURLRequestContextGetter* GetTestRequestContextGetter() { | 180 net::TestURLRequestContextGetter* GetTestRequestContextGetter() { |
180 return fake_default_request_context_getter_; | 181 return fake_default_request_context_getter_; |
181 } | 182 } |
182 | 183 |
183 net::SpawnedTestServer test_server_; | 184 net::SpawnedTestServer test_server_; |
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
677 | 678 |
678 // Sync thread: Finally run the posted task, only to find that our | 679 // Sync thread: Finally run the posted task, only to find that our |
679 // HttpBridgeFactory has been neutered. Should not crash. | 680 // HttpBridgeFactory has been neutered. Should not crash. |
680 factory->Init("TestUserAgent", BindToTrackerCallback()); | 681 factory->Init("TestUserAgent", BindToTrackerCallback()); |
681 | 682 |
682 // At this point, attempting to use the factory would trigger a crash. Both | 683 // At this point, attempting to use the factory would trigger a crash. Both |
683 // this test and the real world code should make sure this never happens. | 684 // this test and the real world code should make sure this never happens. |
684 }; | 685 }; |
685 | 686 |
686 } // namespace syncer | 687 } // namespace syncer |
OLD | NEW |