| 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 <set> | 5 #include <set> |
| 6 #include <string> | 6 #include <string> |
| 7 | 7 |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 using ::testing::SetArgPointee; | 44 using ::testing::SetArgPointee; |
| 45 using ::testing::StrictMock; | 45 using ::testing::StrictMock; |
| 46 using ::testing::_; | 46 using ::testing::_; |
| 47 using content::DownloadInterruptReason; | 47 using content::DownloadInterruptReason; |
| 48 using content::DownloadItem; | 48 using content::DownloadItem; |
| 49 using content::DownloadManager; | 49 using content::DownloadManager; |
| 50 using content::WebContents; | 50 using content::WebContents; |
| 51 | 51 |
| 52 namespace content { | 52 namespace content { |
| 53 class ByteStreamReader; | 53 class ByteStreamReader; |
| 54 class SiteInstance; |
| 54 } | 55 } |
| 55 | 56 |
| 56 namespace { | 57 namespace { |
| 57 | 58 |
| 58 class MockDownloadItemImpl : public DownloadItemImpl { | 59 class MockDownloadItemImpl : public DownloadItemImpl { |
| 59 public: | 60 public: |
| 60 // Use history constructor for minimal base object. | 61 // Use history constructor for minimal base object. |
| 61 MockDownloadItemImpl(DownloadItemImplDelegate* delegate) | 62 MockDownloadItemImpl(DownloadItemImplDelegate* delegate) |
| 62 : DownloadItemImpl(delegate, content::DownloadId(), | 63 : DownloadItemImpl(delegate, content::DownloadId(), |
| 63 content::DownloadPersistentStoreInfo(), | 64 content::DownloadPersistentStoreInfo(), |
| (...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 371 | 372 |
| 372 MOCK_METHOD0(GetPath, FilePath()); | 373 MOCK_METHOD0(GetPath, FilePath()); |
| 373 MOCK_CONST_METHOD0(IsOffTheRecord, bool()); | 374 MOCK_CONST_METHOD0(IsOffTheRecord, bool()); |
| 374 MOCK_METHOD0(GetRequestContext, net::URLRequestContextGetter*()); | 375 MOCK_METHOD0(GetRequestContext, net::URLRequestContextGetter*()); |
| 375 MOCK_METHOD1(GetRequestContextForRenderProcess, | 376 MOCK_METHOD1(GetRequestContextForRenderProcess, |
| 376 net::URLRequestContextGetter*(int renderer_child_id)); | 377 net::URLRequestContextGetter*(int renderer_child_id)); |
| 377 MOCK_METHOD0(GetMediaRequestContext, | 378 MOCK_METHOD0(GetMediaRequestContext, |
| 378 net::URLRequestContextGetter*()); | 379 net::URLRequestContextGetter*()); |
| 379 MOCK_METHOD1(GetMediaRequestContextForRenderProcess, | 380 MOCK_METHOD1(GetMediaRequestContextForRenderProcess, |
| 380 net::URLRequestContextGetter*(int renderer_child_id)); | 381 net::URLRequestContextGetter*(int renderer_child_id)); |
| 381 MOCK_METHOD0(GetResourceContext, content::ResourceContext*()); | 382 MOCK_METHOD1(GetResourceContext, content::ResourceContext*(content::SiteInstan
ce*)); |
| 382 MOCK_METHOD0(GetDownloadManagerDelegate, content::DownloadManagerDelegate*()); | 383 MOCK_METHOD0(GetDownloadManagerDelegate, content::DownloadManagerDelegate*()); |
| 383 MOCK_METHOD0(GetGeolocationPermissionContext, | 384 MOCK_METHOD0(GetGeolocationPermissionContext, |
| 384 content::GeolocationPermissionContext* ()); | 385 content::GeolocationPermissionContext* ()); |
| 385 MOCK_METHOD0(GetSpeechRecognitionPreferences, | 386 MOCK_METHOD0(GetSpeechRecognitionPreferences, |
| 386 content::SpeechRecognitionPreferences* ()); | 387 content::SpeechRecognitionPreferences* ()); |
| 387 MOCK_METHOD0(DidLastSessionExitCleanly, bool()); | 388 MOCK_METHOD0(DidLastSessionExitCleanly, bool()); |
| 388 MOCK_METHOD0(GetSpecialStoragePolicy, quota::SpecialStoragePolicy*()); | 389 MOCK_METHOD0(GetSpecialStoragePolicy, quota::SpecialStoragePolicy*()); |
| 389 }; | 390 }; |
| 390 | 391 |
| 391 class MockDownloadManagerObserver : public content::DownloadManager::Observer { | 392 class MockDownloadManagerObserver : public content::DownloadManager::Observer { |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 646 UpdateItemInPersistentStore(&item)); | 647 UpdateItemInPersistentStore(&item)); |
| 647 EXPECT_CALL(item, GetState()) | 648 EXPECT_CALL(item, GetState()) |
| 648 .WillRepeatedly(Return(DownloadItem::CANCELLED)); | 649 .WillRepeatedly(Return(DownloadItem::CANCELLED)); |
| 649 EXPECT_CALL(item, GetDbHandle()) | 650 EXPECT_CALL(item, GetDbHandle()) |
| 650 .WillRepeatedly(Return(db_handle)); | 651 .WillRepeatedly(Return(db_handle)); |
| 651 | 652 |
| 652 EXPECT_CALL(item, OffThreadCancel()); | 653 EXPECT_CALL(item, OffThreadCancel()); |
| 653 DownloadStopped(&item); | 654 DownloadStopped(&item); |
| 654 EXPECT_EQ(NULL, download_manager_->GetActiveDownloadItem(download_id)); | 655 EXPECT_EQ(NULL, download_manager_->GetActiveDownloadItem(download_id)); |
| 655 } | 656 } |
| OLD | NEW |