OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/threading/thread.h" | 6 #include "base/threading/thread.h" |
7 #include "chrome/browser/sync/glue/http_bridge.h" | 7 #include "chrome/browser/sync/glue/http_bridge.h" |
8 #include "chrome/test/base/test_url_request_context_getter.h" | 8 #include "chrome/test/base/test_url_request_context_getter.h" |
9 #include "content/test/test_browser_thread.h" | 9 #include "content/test/test_browser_thread.h" |
10 #include "content/test/test_url_fetcher_factory.h" | 10 #include "content/test/test_url_fetcher_factory.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 HttpBridgeTest* test) { | 58 HttpBridgeTest* test) { |
59 scoped_refptr<HttpBridge> http_bridge(test->BuildBridge()); | 59 scoped_refptr<HttpBridge> http_bridge(test->BuildBridge()); |
60 EXPECT_TRUE(test->GetTestRequestContextGetter()); | 60 EXPECT_TRUE(test->GetTestRequestContextGetter()); |
61 net::HttpNetworkSession* test_session = | 61 net::HttpNetworkSession* test_session = |
62 test->GetTestRequestContextGetter()->GetURLRequestContext()-> | 62 test->GetTestRequestContextGetter()->GetURLRequestContext()-> |
63 http_transaction_factory()->GetSession(); | 63 http_transaction_factory()->GetSession(); |
64 EXPECT_EQ(test_session, | 64 EXPECT_EQ(test_session, |
65 http_bridge->GetRequestContextGetter()-> | 65 http_bridge->GetRequestContextGetter()-> |
66 GetURLRequestContext()-> | 66 GetURLRequestContext()-> |
67 http_transaction_factory()->GetSession()); | 67 http_transaction_factory()->GetSession()); |
68 main_message_loop->PostTask(FROM_HERE, new MessageLoop::QuitTask); | 68 main_message_loop->PostTask(FROM_HERE, MessageLoop::QuitClosure()); |
69 } | 69 } |
70 | 70 |
71 MessageLoop* GetIOThreadLoop() { | 71 MessageLoop* GetIOThreadLoop() { |
72 return io_thread_.DeprecatedGetThreadObject()->message_loop(); | 72 return io_thread_.DeprecatedGetThreadObject()->message_loop(); |
73 } | 73 } |
74 | 74 |
75 // Note this is lazy created, so don't call this before your bridge. | 75 // Note this is lazy created, so don't call this before your bridge. |
76 TestURLRequestContextGetter* GetTestRequestContextGetter() { | 76 TestURLRequestContextGetter* GetTestRequestContextGetter() { |
77 return fake_default_request_context_getter_; | 77 return fake_default_request_context_getter_; |
78 } | 78 } |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 http_bridge->SetPostPayload("text/plain", 2, " "); | 295 http_bridge->SetPostPayload("text/plain", 2, " "); |
296 | 296 |
297 int os_error = 0; | 297 int os_error = 0; |
298 int response_code = 0; | 298 int response_code = 0; |
299 | 299 |
300 bool success = http_bridge->MakeSynchronousPost(&os_error, &response_code); | 300 bool success = http_bridge->MakeSynchronousPost(&os_error, &response_code); |
301 ASSERT_TRUE(success); | 301 ASSERT_TRUE(success); |
302 http_bridge->Abort(); | 302 http_bridge->Abort(); |
303 // Ensures no double-free of URLFetcher, etc. | 303 // Ensures no double-free of URLFetcher, etc. |
304 } | 304 } |
OLD | NEW |