| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #import "ios/chrome/browser/net/retryable_url_fetcher.h" | 5 #import "ios/chrome/browser/net/retryable_url_fetcher.h" |
| 6 | 6 |
| 7 #import "base/mac/scoped_nsobject.h" | 7 #import "base/mac/scoped_nsobject.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "ios/web/public/test/test_web_thread.h" | 9 #include "ios/web/public/test/test_web_thread.h" |
| 10 #include "net/url_request/test_url_fetcher_factory.h" | 10 #include "net/url_request/test_url_fetcher_factory.h" |
| 11 #include "net/url_request/url_fetcher_delegate.h" | 11 #include "net/url_request/url_fetcher_delegate.h" |
| 12 #include "net/url_request/url_request_test_util.h" | 12 #include "net/url_request/url_request_test_util.h" |
| 13 #import "testing/gtest_mac.h" | 13 #import "testing/gtest_mac.h" |
| 14 #include "testing/platform_test.h" | 14 #include "testing/platform_test.h" |
| 15 | 15 |
| 16 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 17 #error "This file requires ARC support." |
| 18 #endif |
| 19 |
| 16 namespace { | 20 namespace { |
| 17 // An arbitrary text string for a fake response. | 21 // An arbitrary text string for a fake response. |
| 18 NSString* const kFakeResponseString = @"Something interesting here."; | 22 NSString* const kFakeResponseString = @"Something interesting here."; |
| 19 } | 23 } |
| 20 | 24 |
| 21 // Delegate object to provide data for RetryableURLFetcher and | 25 // Delegate object to provide data for RetryableURLFetcher and |
| 22 // handles the callback when URL is fetched. | 26 // handles the callback when URL is fetched. |
| 23 @interface TestRetryableURLFetcherDelegate | 27 @interface TestRetryableURLFetcherDelegate |
| 24 : NSObject<RetryableURLFetcherDelegate> | 28 : NSObject<RetryableURLFetcherDelegate> |
| 25 // Counts the number of times that a successful response has been processed. | 29 // Counts the number of times that a successful response has been processed. |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 // |failing_delegate| does not have URL to fetch, so a fetcher should never | 140 // |failing_delegate| does not have URL to fetch, so a fetcher should never |
| 137 // be created. | 141 // be created. |
| 138 net::TestURLFetcher* fetcher = factory_.GetFetcherByID(0); | 142 net::TestURLFetcher* fetcher = factory_.GetFetcherByID(0); |
| 139 EXPECT_FALSE(fetcher); | 143 EXPECT_FALSE(fetcher); |
| 140 | 144 |
| 141 // Verify that response has been called. | 145 // Verify that response has been called. |
| 142 EXPECT_TRUE([failing_delegate responsesProcessed]); | 146 EXPECT_TRUE([failing_delegate responsesProcessed]); |
| 143 } | 147 } |
| 144 | 148 |
| 145 } // namespace | 149 } // namespace |
| OLD | NEW |