| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "content/common/net/url_fetcher_impl.h" | 5 #include "content/common/net/url_fetcher_impl.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 } | 250 } |
| 251 return context_; | 251 return context_; |
| 252 } | 252 } |
| 253 virtual scoped_refptr<base::MessageLoopProxy> GetIOMessageLoopProxy() const { | 253 virtual scoped_refptr<base::MessageLoopProxy> GetIOMessageLoopProxy() const { |
| 254 return io_message_loop_proxy_; | 254 return io_message_loop_proxy_; |
| 255 } | 255 } |
| 256 void WaitForContextCreation() { | 256 void WaitForContextCreation() { |
| 257 context_created_.Wait(); | 257 context_created_.Wait(); |
| 258 } | 258 } |
| 259 | 259 |
| 260 protected: |
| 261 virtual ~CancelTestURLRequestContextGetter() {} |
| 262 |
| 260 private: | 263 private: |
| 261 ~CancelTestURLRequestContextGetter() {} | |
| 262 | |
| 263 scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy_; | 264 scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy_; |
| 264 base::WaitableEvent context_created_; | 265 base::WaitableEvent context_created_; |
| 265 scoped_refptr<net::URLRequestContext> context_; | 266 scoped_refptr<net::URLRequestContext> context_; |
| 266 }; | 267 }; |
| 267 | 268 |
| 268 // Version of URLFetcherTest that tests retying the same request twice. | 269 // Version of URLFetcherTest that tests retying the same request twice. |
| 269 class URLFetcherMultipleAttemptTest : public URLFetcherTest { | 270 class URLFetcherMultipleAttemptTest : public URLFetcherTest { |
| 270 public: | 271 public: |
| 271 // content::URLFetcherDelegate | 272 // content::URLFetcherDelegate |
| 272 virtual void OnURLFetchComplete(const content::URLFetcher* source) OVERRIDE; | 273 virtual void OnURLFetchComplete(const content::URLFetcher* source) OVERRIDE; |
| (...skipping 829 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1102 std::string(kTestServerFilePrefix) + kFileToFetch)); | 1103 std::string(kTestServerFilePrefix) + kFileToFetch)); |
| 1103 | 1104 |
| 1104 MessageLoop::current()->Run(); // OnURLFetchComplete() will Quit(). | 1105 MessageLoop::current()->Run(); // OnURLFetchComplete() will Quit(). |
| 1105 | 1106 |
| 1106 MessageLoop::current()->RunAllPending(); | 1107 MessageLoop::current()->RunAllPending(); |
| 1107 ASSERT_FALSE(file_util::PathExists(file_path_)) | 1108 ASSERT_FALSE(file_util::PathExists(file_path_)) |
| 1108 << file_path_.value() << " not removed."; | 1109 << file_path_.value() << " not removed."; |
| 1109 } | 1110 } |
| 1110 | 1111 |
| 1111 } // namespace. | 1112 } // namespace. |
| OLD | NEW |