| OLD | NEW |
| 1 // Copyright (c) 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/message_loop_proxy.h" | 5 #include "base/message_loop_proxy.h" |
| 6 #include "base/synchronization/waitable_event.h" | 6 #include "base/synchronization/waitable_event.h" |
| 7 #include "base/threading/thread.h" | 7 #include "base/threading/thread.h" |
| 8 #include "net/test/test_server.h" | 8 #include "net/test/test_server.h" |
| 9 #include "net/url_request/test_url_fetcher_factory.h" | 9 #include "net/url_request/test_url_fetcher_factory.h" |
| 10 #include "net/url_request/url_fetcher_delegate.h" | 10 #include "net/url_request/url_fetcher_delegate.h" |
| 11 #include "net/url_request/url_request_test_util.h" | 11 #include "net/url_request/url_request_test_util.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 base::WaitableEvent* signal_when_released); | 68 base::WaitableEvent* signal_when_released); |
| 69 | 69 |
| 70 static void TestSameHttpNetworkSession(MessageLoop* main_message_loop, | 70 static void TestSameHttpNetworkSession(MessageLoop* main_message_loop, |
| 71 SyncHttpBridgeTest* test) { | 71 SyncHttpBridgeTest* test) { |
| 72 scoped_refptr<HttpBridge> http_bridge(test->BuildBridge()); | 72 scoped_refptr<HttpBridge> http_bridge(test->BuildBridge()); |
| 73 EXPECT_TRUE(test->GetTestRequestContextGetter()); | 73 EXPECT_TRUE(test->GetTestRequestContextGetter()); |
| 74 net::HttpNetworkSession* test_session = | 74 net::HttpNetworkSession* test_session = |
| 75 test->GetTestRequestContextGetter()->GetURLRequestContext()-> | 75 test->GetTestRequestContextGetter()->GetURLRequestContext()-> |
| 76 http_transaction_factory()->GetSession(); | 76 http_transaction_factory()->GetSession(); |
| 77 EXPECT_EQ(test_session, | 77 EXPECT_EQ(test_session, |
| 78 http_bridge->GetRequestContextGetter()-> | 78 http_bridge->GetRequestContextGetterForTest()-> |
| 79 GetURLRequestContext()-> | 79 GetURLRequestContext()-> |
| 80 http_transaction_factory()->GetSession()); | 80 http_transaction_factory()->GetSession()); |
| 81 main_message_loop->PostTask(FROM_HERE, MessageLoop::QuitClosure()); | 81 main_message_loop->PostTask(FROM_HERE, MessageLoop::QuitClosure()); |
| 82 } | 82 } |
| 83 | 83 |
| 84 MessageLoop* GetIOThreadLoop() { | 84 MessageLoop* GetIOThreadLoop() { |
| 85 return io_thread_.message_loop(); | 85 return io_thread_.message_loop(); |
| 86 } | 86 } |
| 87 | 87 |
| 88 // Note this is lazy created, so don't call this before your bridge. | 88 // Note this is lazy created, so don't call this before your bridge. |
| (...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 397 // succeed even though we Release()d the bridge above because the call to | 397 // succeed even though we Release()d the bridge above because the call to |
| 398 // Abort should have held a reference. | 398 // Abort should have held a reference. |
| 399 io_waiter.Signal(); | 399 io_waiter.Signal(); |
| 400 | 400 |
| 401 // Done. | 401 // Done. |
| 402 sync_thread.Stop(); | 402 sync_thread.Stop(); |
| 403 io_thread()->Stop(); | 403 io_thread()->Stop(); |
| 404 } | 404 } |
| 405 | 405 |
| 406 } // namespace syncer | 406 } // namespace syncer |
| OLD | NEW |