| 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/macros.h" | 
|   12 #include "base/memory/ptr_util.h" |   12 #include "base/memory/ptr_util.h" | 
|   13 #include "base/memory/ref_counted.h" |   13 #include "base/memory/ref_counted.h" | 
|   14 #include "base/run_loop.h" |   14 #include "base/run_loop.h" | 
|   15 #include "base/threading/thread.h" |   15 #include "base/threading/thread.h" | 
|   16 #include "base/threading/thread_task_runner_handle.h" |   16 #include "base/threading/thread_task_runner_handle.h" | 
|   17 #include "build/build_config.h" |   17 #include "build/build_config.h" | 
|   18 #include "net/http/http_response_headers.h" |   18 #include "net/http/http_response_headers.h" | 
|   19 #include "net/url_request/test_url_fetcher_factory.h" |   19 #include "net/url_request/test_url_fetcher_factory.h" | 
|   20 #include "net/url_request/url_request_test_util.h" |   20 #include "net/url_request/url_request_test_util.h" | 
|   21 #include "testing/gtest/include/gtest/gtest.h" |   21 #include "testing/gtest/include/gtest/gtest.h" | 
|   22 #include "testing/platform_test.h" |   22 #include "testing/platform_test.h" | 
|   23  |   23  | 
 |   24 #if !defined(__has_feature) || !__has_feature(objc_arc) | 
 |   25 #error "This file requires ARC support." | 
 |   26 #endif | 
 |   27  | 
|   24 namespace { |   28 namespace { | 
|   25  |   29  | 
|   26 static unsigned char kJPGImage[] = { |   30 static unsigned char kJPGImage[] = { | 
|   27     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, |   31     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, | 
|   28     114,101,97,116,101,100,32,119,105,116,104,32,71,73,77,80,255,219,0,67, |   32     114,101,97,116,101,100,32,119,105,116,104,32,71,73,77,80,255,219,0,67, | 
|   29     0,5,3,4,4,4,3,5,4,4,4,5,5,5,6,7,12,8,7,7,7,7,15,11,11,9,12,17,15,18,18, |   33     0,5,3,4,4,4,3,5,4,4,4,5,5,5,6,7,12,8,7,7,7,7,15,11,11,9,12,17,15,18,18, | 
|   30     17,15,17,17,19,22,28,23,19,20,26,21,17,17,24,33,24,26,29,29,31,31,31, |   34     17,15,17,17,19,22,28,23,19,20,26,21,17,17,24,33,24,26,29,29,31,31,31, | 
|   31     19,23,34,36,34,30,36,28,30,31,30,255,219,0,67,1,5,5,5,7,6,7,14,8,8,14, |   35     19,23,34,36,34,30,36,28,30,31,30,255,219,0,67,1,5,5,5,7,6,7,14,8,8,14, | 
|   32     30,20,17,20,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30, |   36     30,20,17,20,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30, | 
|   33     30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30, |   37     30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30, | 
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  190   EXPECT_EQ(nil, result_); |  194   EXPECT_EQ(nil, result_); | 
|  191   EXPECT_FALSE(called_); |  195   EXPECT_FALSE(called_); | 
|  192 } |  196 } | 
|  193  |  197  | 
|  194 TEST_F(ImageFetcherTest, TestCallbacksNotCalledDuringDeletion) { |  198 TEST_F(ImageFetcherTest, TestCallbacksNotCalledDuringDeletion) { | 
|  195   image_fetcher_->StartDownload(GURL(kTestUrl), callback_); |  199   image_fetcher_->StartDownload(GURL(kTestUrl), callback_); | 
|  196   image_fetcher_.reset(); |  200   image_fetcher_.reset(); | 
|  197   EXPECT_FALSE(called_); |  201   EXPECT_FALSE(called_); | 
|  198 } |  202 } | 
|  199  |  203  | 
| OLD | NEW |