| OLD | NEW |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 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 #import "ios/chrome/browser/net/image_fetcher.h" | 5 #import "ios/chrome/browser/net/image_fetcher.h" |
| 6 | 6 |
| 7 #import <UIKit/UIKit.h> | 7 #import <UIKit/UIKit.h> |
| 8 | 8 |
| 9 #include "base/ios/ios_util.h" | 9 #include "base/ios/ios_util.h" |
| 10 #include "base/mac/scoped_block.h" | 10 #include "base/mac/scoped_block.h" |
| 11 #include "base/macros.h" |
| 11 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 12 #include "base/run_loop.h" | 13 #include "base/run_loop.h" |
| 13 #include "base/thread_task_runner_handle.h" | 14 #include "base/thread_task_runner_handle.h" |
| 15 #include "build/build_config.h" |
| 14 #include "net/http/http_response_headers.h" | 16 #include "net/http/http_response_headers.h" |
| 15 #include "net/url_request/test_url_fetcher_factory.h" | 17 #include "net/url_request/test_url_fetcher_factory.h" |
| 16 #include "net/url_request/url_request_test_util.h" | 18 #include "net/url_request/url_request_test_util.h" |
| 17 #include "testing/gtest/include/gtest/gtest.h" | 19 #include "testing/gtest/include/gtest/gtest.h" |
| 18 #include "testing/platform_test.h" | 20 #include "testing/platform_test.h" |
| 19 | 21 |
| 20 namespace { | 22 namespace { |
| 21 | 23 |
| 22 static unsigned char kJPGImage[] = { | 24 static unsigned char kJPGImage[] = { |
| 23 255,216,255,224,0,16,74,70,73,70,0,1,1,1,0,72,0,72,0,0,255,254,0,19,67, | 25 255,216,255,224,0,16,74,70,73,70,0,1,1,1,0,72,0,72,0,0,255,254,0,19,67, |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 EXPECT_EQ(static_cast<UIImage*>(nil), result_); | 184 EXPECT_EQ(static_cast<UIImage*>(nil), result_); |
| 183 EXPECT_FALSE(called_); | 185 EXPECT_FALSE(called_); |
| 184 } | 186 } |
| 185 | 187 |
| 186 TEST_F(ImageFetcherTest, TestCallbacksNotCalledDuringDeletion) { | 188 TEST_F(ImageFetcherTest, TestCallbacksNotCalledDuringDeletion) { |
| 187 image_fetcher_->StartDownload(GURL(kTestUrl), callback_); | 189 image_fetcher_->StartDownload(GURL(kTestUrl), callback_); |
| 188 image_fetcher_.reset(); | 190 image_fetcher_.reset(); |
| 189 EXPECT_FALSE(called_); | 191 EXPECT_FALSE(called_); |
| 190 } | 192 } |
| 191 | 193 |
| OLD | NEW |