| 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/browser/browser_thread.h" | 9 #include "content/browser/browser_thread.h" |
| 10 #include "content/test/test_url_fetcher_factory.h" | 10 #include "content/test/test_url_fetcher_factory.h" |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 | 85 |
| 86 // Separate thread for IO used by the HttpBridge. | 86 // Separate thread for IO used by the HttpBridge. |
| 87 BrowserThread io_thread_; | 87 BrowserThread io_thread_; |
| 88 MessageLoop loop_; | 88 MessageLoop loop_; |
| 89 }; | 89 }; |
| 90 | 90 |
| 91 class DummyURLFetcher : public TestURLFetcher { | 91 class DummyURLFetcher : public TestURLFetcher { |
| 92 public: | 92 public: |
| 93 DummyURLFetcher() : TestURLFetcher(0, GURL(), POST, NULL) {} | 93 DummyURLFetcher() : TestURLFetcher(0, GURL(), POST, NULL) {} |
| 94 | 94 |
| 95 net::HttpResponseHeaders* response_headers() const { | 95 net::HttpResponseHeaders* GetResponseHeaders() const { |
| 96 return NULL; | 96 return NULL; |
| 97 } | 97 } |
| 98 }; | 98 }; |
| 99 | 99 |
| 100 // An HttpBridge that doesn't actually make network requests and just calls | 100 // An HttpBridge that doesn't actually make network requests and just calls |
| 101 // back with dummy response info. | 101 // back with dummy response info. |
| 102 class ShuntedHttpBridge : public HttpBridge { | 102 class ShuntedHttpBridge : public HttpBridge { |
| 103 public: | 103 public: |
| 104 // If |never_finishes| is true, the simulated request never actually | 104 // If |never_finishes| is true, the simulated request never actually |
| 105 // returns. | 105 // returns. |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 http_bridge->SetPostPayload("text/plain", 2, " "); | 303 http_bridge->SetPostPayload("text/plain", 2, " "); |
| 304 | 304 |
| 305 int os_error = 0; | 305 int os_error = 0; |
| 306 int response_code = 0; | 306 int response_code = 0; |
| 307 | 307 |
| 308 bool success = http_bridge->MakeSynchronousPost(&os_error, &response_code); | 308 bool success = http_bridge->MakeSynchronousPost(&os_error, &response_code); |
| 309 ASSERT_TRUE(success); | 309 ASSERT_TRUE(success); |
| 310 http_bridge->Abort(); | 310 http_bridge->Abort(); |
| 311 // Ensures no double-free of URLFetcher, etc. | 311 // Ensures no double-free of URLFetcher, etc. |
| 312 } | 312 } |
| OLD | NEW |