Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(318)

Side by Side Diff: content/browser/download/download_item_impl_unittest.cc

Issue 1518093002: Cleanup DownloadItemImpl unittests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@cleanup-download-item
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "base/callback.h" 5 #include "base/callback.h"
6 #include "base/command_line.h" 6 #include "base/command_line.h"
7 #include "base/message_loop/message_loop.h" 7 #include "base/message_loop/message_loop.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "base/threading/thread.h" 9 #include "base/threading/thread.h"
10 #include "content/browser/byte_stream.h" 10 #include "content/browser/byte_stream.h"
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 class MockRequestHandle : public DownloadRequestHandleInterface { 86 class MockRequestHandle : public DownloadRequestHandleInterface {
87 public: 87 public:
88 MOCK_CONST_METHOD0(GetWebContents, WebContents*()); 88 MOCK_CONST_METHOD0(GetWebContents, WebContents*());
89 MOCK_CONST_METHOD0(GetDownloadManager, DownloadManager*()); 89 MOCK_CONST_METHOD0(GetDownloadManager, DownloadManager*());
90 MOCK_CONST_METHOD0(PauseRequest, void()); 90 MOCK_CONST_METHOD0(PauseRequest, void());
91 MOCK_CONST_METHOD0(ResumeRequest, void()); 91 MOCK_CONST_METHOD0(ResumeRequest, void());
92 MOCK_CONST_METHOD0(CancelRequest, void()); 92 MOCK_CONST_METHOD0(CancelRequest, void());
93 MOCK_CONST_METHOD0(DebugString, std::string()); 93 MOCK_CONST_METHOD0(DebugString, std::string());
94 }; 94 };
95 95
96 // Schedules a task to invoke the RenameCompletionCallback with |new_path| on 96 class TestDownloadItemObserver : public DownloadItem::Observer {
97 // the UI thread. Should only be used as the action for
98 // MockDownloadFile::Rename as follows:
99 // EXPECT_CALL(download_file, Rename*(_,_))
100 // .WillOnce(ScheduleRenameCallback(DOWNLOAD_INTERRUPT_REASON_NONE,
101 // new_path));
102 ACTION_P2(ScheduleRenameCallback, interrupt_reason, new_path) {
103 BrowserThread::PostTask(
104 BrowserThread::UI, FROM_HERE,
105 base::Bind(arg1, interrupt_reason, new_path));
106 }
107
108 } // namespace
109
110 class DownloadItemTest : public testing::Test {
111 public: 97 public:
112 class MockObserver : public DownloadItem::Observer { 98 explicit TestDownloadItemObserver(DownloadItem* item)
113 public:
114 explicit MockObserver(DownloadItem* item)
115 : item_(item), 99 : item_(item),
116 last_state_(item->GetState()), 100 last_state_(item->GetState()),
117 removed_(false), 101 removed_(false),
118 destroyed_(false), 102 destroyed_(false),
119 updated_(false), 103 updated_(false),
120 interrupt_count_(0), 104 interrupt_count_(0),
121 resume_count_(0) { 105 resume_count_(0) {
122 item_->AddObserver(this); 106 item_->AddObserver(this);
107 }
108
109 ~TestDownloadItemObserver() override {
110 if (item_)
111 item_->RemoveObserver(this);
112 }
113
114 void OnDownloadRemoved(DownloadItem* download) override {
115 DVLOG(20) << " " << __FUNCTION__
116 << " download = " << download->DebugString(false);
117 removed_ = true;
118 }
119
120 void OnDownloadUpdated(DownloadItem* download) override {
121 DVLOG(20) << " " << __FUNCTION__
122 << " download = " << download->DebugString(false);
123 updated_ = true;
124 DownloadItem::DownloadState new_state = download->GetState();
125 if (last_state_ == DownloadItem::IN_PROGRESS &&
126 new_state == DownloadItem::INTERRUPTED) {
127 interrupt_count_++;
123 } 128 }
129 if (last_state_ == DownloadItem::INTERRUPTED &&
130 new_state == DownloadItem::IN_PROGRESS) {
131 resume_count_++;
132 }
133 last_state_ = new_state;
134 }
124 135
125 ~MockObserver() override { 136 void OnDownloadOpened(DownloadItem* download) override {
126 if (item_) item_->RemoveObserver(this); 137 DVLOG(20) << " " << __FUNCTION__
127 } 138 << " download = " << download->DebugString(false);
139 }
128 140
129 void OnDownloadRemoved(DownloadItem* download) override { 141 void OnDownloadDestroyed(DownloadItem* download) override {
130 DVLOG(20) << " " << __FUNCTION__ 142 DVLOG(20) << " " << __FUNCTION__
131 << " download = " << download->DebugString(false); 143 << " download = " << download->DebugString(false);
132 removed_ = true; 144 destroyed_ = true;
133 } 145 item_->RemoveObserver(this);
146 item_ = NULL;
147 }
134 148
135 void OnDownloadUpdated(DownloadItem* download) override { 149 bool CheckRemoved() const { return removed_; }
svaldez 2015/12/11 21:02:21 Possibly change to removed()?
asanka 2015/12/11 21:30:21 Changed to download_removed() since otherwise the
136 DVLOG(20) << " " << __FUNCTION__
137 << " download = " << download->DebugString(false);
138 updated_ = true;
139 DownloadItem::DownloadState new_state = download->GetState();
140 if (last_state_ == DownloadItem::IN_PROGRESS &&
141 new_state == DownloadItem::INTERRUPTED) {
142 interrupt_count_++;
143 }
144 if (last_state_ == DownloadItem::INTERRUPTED &&
145 new_state == DownloadItem::IN_PROGRESS) {
146 resume_count_++;
147 }
148 last_state_ = new_state;
149 }
150 150
151 void OnDownloadOpened(DownloadItem* download) override { 151 bool CheckDestroyed() const { return destroyed_; }
svaldez 2015/12/11 21:02:21 destroyed()?
asanka 2015/12/11 21:30:21 Went with download_destroyed() for same reason.
152 DVLOG(20) << " " << __FUNCTION__
153 << " download = " << download->DebugString(false);
154 }
155 152
156 void OnDownloadDestroyed(DownloadItem* download) override { 153 bool CheckAndResetUpdated() {
157 DVLOG(20) << " " << __FUNCTION__ 154 bool was_updated = updated_;
158 << " download = " << download->DebugString(false); 155 updated_ = false;
159 destroyed_ = true; 156 return was_updated;
160 item_->RemoveObserver(this); 157 }
161 item_ = NULL;
162 }
163 158
164 bool CheckRemoved() { 159 int GetInterruptCount() const { return interrupt_count_; }
svaldez 2015/12/11 21:02:21 Possibly change to interrupt_count().
asanka 2015/12/11 21:30:21 Done.
165 return removed_;
166 }
167 160
168 bool CheckDestroyed() { 161 int GetResumeCount() const { return resume_count_; }
svaldez 2015/12/11 21:02:21 Possibly change to resume_count().
asanka 2015/12/11 21:30:21 Done.
169 return destroyed_;
170 }
171 162
172 bool CheckUpdated() { 163 private:
173 bool was_updated = updated_; 164 DownloadItem* item_;
174 updated_ = false; 165 DownloadItem::DownloadState last_state_;
175 return was_updated; 166 bool removed_;
176 } 167 bool destroyed_;
168 bool updated_;
169 int interrupt_count_;
170 int resume_count_;
171 };
177 172
178 int GetInterruptCount() { 173 // Schedules a task to invoke the RenameCompletionCallback with |new_path| on
179 return interrupt_count_; 174 // the UI thread. Should only be used as the action for
180 } 175 // MockDownloadFile::Rename as follows:
176 // EXPECT_CALL(download_file, Rename*(_,_))
177 // .WillOnce(ScheduleRenameCallback(DOWNLOAD_INTERRUPT_REASON_NONE,
178 // new_path));
179 ACTION_P2(ScheduleRenameCallback, interrupt_reason, new_path) {
180 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
181 base::Bind(arg1, interrupt_reason, new_path));
182 }
181 183
182 int GetResumeCount() { 184 } // namespace
183 return resume_count_;
184 }
185 185
186 private: 186 class DownloadItemTest : public testing::Test {
187 DownloadItem* item_; 187 public:
188 DownloadItem::DownloadState last_state_;
189 bool removed_;
190 bool destroyed_;
191 bool updated_;
192 int interrupt_count_;
193 int resume_count_;
194 };
195
196 DownloadItemTest() 188 DownloadItemTest()
197 : ui_thread_(BrowserThread::UI, &loop_), 189 : ui_thread_(BrowserThread::UI, &loop_),
198 file_thread_(BrowserThread::FILE, &loop_), 190 file_thread_(BrowserThread::FILE, &loop_),
199 delegate_() { 191 delegate_() {
200 } 192 }
201 193
202 ~DownloadItemTest() { 194 ~DownloadItemTest() {
203 } 195 }
204 196
205 virtual void SetUp() { 197 virtual void SetUp() {
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 // Tests to ensure calls that change a DownloadItem generate an update to 325 // Tests to ensure calls that change a DownloadItem generate an update to
334 // observers. 326 // observers.
335 // State changing functions not tested: 327 // State changing functions not tested:
336 // void OpenDownload(); 328 // void OpenDownload();
337 // void ShowDownloadInShell(); 329 // void ShowDownloadInShell();
338 // void CompleteDelayedDownload(); 330 // void CompleteDelayedDownload();
339 // set_* mutators 331 // set_* mutators
340 332
341 TEST_F(DownloadItemTest, NotificationAfterUpdate) { 333 TEST_F(DownloadItemTest, NotificationAfterUpdate) {
342 DownloadItemImpl* item = CreateDownloadItem(); 334 DownloadItemImpl* item = CreateDownloadItem();
343 MockObserver observer(item); 335 TestDownloadItemObserver observer(item);
344 336
345 item->DestinationUpdate(kDownloadChunkSize, kDownloadSpeed, std::string()); 337 item->DestinationUpdate(kDownloadChunkSize, kDownloadSpeed, std::string());
346 ASSERT_TRUE(observer.CheckUpdated()); 338 ASSERT_TRUE(observer.CheckAndResetUpdated());
347 EXPECT_EQ(kDownloadSpeed, item->CurrentSpeed()); 339 EXPECT_EQ(kDownloadSpeed, item->CurrentSpeed());
348 } 340 }
349 341
350 TEST_F(DownloadItemTest, NotificationAfterCancel) { 342 TEST_F(DownloadItemTest, NotificationAfterCancel) {
351 DownloadItemImpl* user_cancel = CreateDownloadItem(); 343 DownloadItemImpl* user_cancel = CreateDownloadItem();
352 MockDownloadFile* download_file = 344 MockDownloadFile* download_file =
353 AddDownloadFileToDownloadItem(user_cancel, NULL); 345 AddDownloadFileToDownloadItem(user_cancel, NULL);
354 EXPECT_CALL(*download_file, Cancel()); 346 EXPECT_CALL(*download_file, Cancel());
355 MockObserver observer1(user_cancel); 347 TestDownloadItemObserver observer1(user_cancel);
356 348
357 user_cancel->Cancel(true); 349 user_cancel->Cancel(true);
358 ASSERT_TRUE(observer1.CheckUpdated()); 350 ASSERT_TRUE(observer1.CheckAndResetUpdated());
359 351
360 DownloadItemImpl* system_cancel = CreateDownloadItem(); 352 DownloadItemImpl* system_cancel = CreateDownloadItem();
361 download_file = AddDownloadFileToDownloadItem(system_cancel, NULL); 353 download_file = AddDownloadFileToDownloadItem(system_cancel, NULL);
362 EXPECT_CALL(*download_file, Cancel()); 354 EXPECT_CALL(*download_file, Cancel());
363 MockObserver observer2(system_cancel); 355 TestDownloadItemObserver observer2(system_cancel);
364 356
365 system_cancel->Cancel(false); 357 system_cancel->Cancel(false);
366 ASSERT_TRUE(observer2.CheckUpdated()); 358 ASSERT_TRUE(observer2.CheckAndResetUpdated());
367 } 359 }
368 360
369 TEST_F(DownloadItemTest, NotificationAfterComplete) { 361 TEST_F(DownloadItemTest, NotificationAfterComplete) {
370 DownloadItemImpl* item = CreateDownloadItem(); 362 DownloadItemImpl* item = CreateDownloadItem();
371 MockObserver observer(item); 363 TestDownloadItemObserver observer(item);
372 364
373 item->OnAllDataSaved(DownloadItem::kEmptyFileHash); 365 item->OnAllDataSaved(DownloadItem::kEmptyFileHash);
374 ASSERT_TRUE(observer.CheckUpdated()); 366 ASSERT_TRUE(observer.CheckAndResetUpdated());
375 367
376 item->MarkAsComplete(); 368 item->MarkAsComplete();
377 ASSERT_TRUE(observer.CheckUpdated()); 369 ASSERT_TRUE(observer.CheckAndResetUpdated());
378 } 370 }
379 371
380 TEST_F(DownloadItemTest, NotificationAfterDownloadedFileRemoved) { 372 TEST_F(DownloadItemTest, NotificationAfterDownloadedFileRemoved) {
381 DownloadItemImpl* item = CreateDownloadItem(); 373 DownloadItemImpl* item = CreateDownloadItem();
382 MockObserver observer(item); 374 TestDownloadItemObserver observer(item);
383 375
384 item->OnDownloadedFileRemoved(); 376 item->OnDownloadedFileRemoved();
385 ASSERT_TRUE(observer.CheckUpdated()); 377 ASSERT_TRUE(observer.CheckAndResetUpdated());
386 } 378 }
387 379
388 TEST_F(DownloadItemTest, NotificationAfterInterrupted) { 380 TEST_F(DownloadItemTest, NotificationAfterInterrupted) {
389 DownloadItemImpl* item = CreateDownloadItem(); 381 DownloadItemImpl* item = CreateDownloadItem();
390 MockDownloadFile* download_file = 382 MockDownloadFile* download_file =
391 DoIntermediateRename(item, DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS); 383 DoIntermediateRename(item, DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS);
392 EXPECT_CALL(*download_file, Cancel()); 384 EXPECT_CALL(*download_file, Cancel());
393 MockObserver observer(item); 385 TestDownloadItemObserver observer(item);
394 386
395 EXPECT_CALL(*mock_delegate(), MockResumeInterruptedDownload(_,_)) 387 EXPECT_CALL(*mock_delegate(), MockResumeInterruptedDownload(_,_))
396 .Times(0); 388 .Times(0);
397 389
398 item->DestinationObserverAsWeakPtr()->DestinationError( 390 item->DestinationObserverAsWeakPtr()->DestinationError(
399 DOWNLOAD_INTERRUPT_REASON_FILE_FAILED); 391 DOWNLOAD_INTERRUPT_REASON_FILE_FAILED);
400 ASSERT_TRUE(observer.CheckUpdated()); 392 ASSERT_TRUE(observer.CheckAndResetUpdated());
401 } 393 }
402 394
403 TEST_F(DownloadItemTest, NotificationAfterDestroyed) { 395 TEST_F(DownloadItemTest, NotificationAfterDestroyed) {
404 DownloadItemImpl* item = CreateDownloadItem(); 396 DownloadItemImpl* item = CreateDownloadItem();
405 MockObserver observer(item); 397 TestDownloadItemObserver observer(item);
406 398
407 DestroyDownloadItem(item); 399 DestroyDownloadItem(item);
408 ASSERT_TRUE(observer.CheckDestroyed()); 400 ASSERT_TRUE(observer.CheckDestroyed());
409 } 401 }
410 402
411 TEST_F(DownloadItemTest, ContinueAfterInterrupted) { 403 TEST_F(DownloadItemTest, ContinueAfterInterrupted) {
412 base::CommandLine::ForCurrentProcess()->AppendSwitch( 404 base::CommandLine::ForCurrentProcess()->AppendSwitch(
413 switches::kEnableDownloadResumption); 405 switches::kEnableDownloadResumption);
414 406
415 TestBrowserContext test_browser_context; 407 TestBrowserContext test_browser_context;
416 DownloadItemImpl* item = CreateDownloadItem(); 408 DownloadItemImpl* item = CreateDownloadItem();
417 MockObserver observer(item); 409 TestDownloadItemObserver observer(item);
418 DownloadItemImplDelegate::DownloadTargetCallback callback; 410 DownloadItemImplDelegate::DownloadTargetCallback callback;
419 MockDownloadFile* download_file = 411 MockDownloadFile* download_file =
420 DoIntermediateRename(item, DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS); 412 DoIntermediateRename(item, DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS);
421 413
422 // Interrupt the download, using a continuable interrupt. 414 // Interrupt the download, using a continuable interrupt.
423 EXPECT_CALL(*download_file, FullPath()) 415 EXPECT_CALL(*download_file, FullPath())
424 .WillOnce(Return(base::FilePath())); 416 .WillOnce(Return(base::FilePath()));
425 EXPECT_CALL(*download_file, Detach()); 417 EXPECT_CALL(*download_file, Detach());
426 EXPECT_CALL(*mock_delegate(), GetBrowserContext()) 418 EXPECT_CALL(*mock_delegate(), GetBrowserContext())
427 .WillRepeatedly(Return(&test_browser_context)); 419 .WillRepeatedly(Return(&test_browser_context));
428 EXPECT_CALL(*mock_delegate(), MockResumeInterruptedDownload(_, _)).Times(1); 420 EXPECT_CALL(*mock_delegate(), MockResumeInterruptedDownload(_, _)).Times(1);
429 item->DestinationObserverAsWeakPtr()->DestinationError( 421 item->DestinationObserverAsWeakPtr()->DestinationError(
430 DOWNLOAD_INTERRUPT_REASON_FILE_TRANSIENT_ERROR); 422 DOWNLOAD_INTERRUPT_REASON_FILE_TRANSIENT_ERROR);
431 ASSERT_TRUE(observer.CheckUpdated()); 423 ASSERT_TRUE(observer.CheckAndResetUpdated());
432 ASSERT_EQ(1, observer.GetInterruptCount()); 424 ASSERT_EQ(1, observer.GetInterruptCount());
433 425
434 // Test expectations verify that ResumeInterruptedDownload() is called when 426 // Test expectations verify that ResumeInterruptedDownload() is called when
435 // the download is interrupted. But the mock doesn't actually invoke 427 // the download is interrupted. But the mock doesn't actually invoke
436 ASSERT_EQ(0, observer.GetResumeCount()); 428 ASSERT_EQ(0, observer.GetResumeCount());
437 RunAllPendingInMessageLoops(); 429 RunAllPendingInMessageLoops();
438 430
439 CleanupItem(item, download_file, DownloadItem::INTERRUPTED); 431 CleanupItem(item, download_file, DownloadItem::INTERRUPTED);
440 } 432 }
441 433
442 // Same as above, but with a non-continuable interrupt. 434 // Same as above, but with a non-continuable interrupt.
443 TEST_F(DownloadItemTest, RestartAfterInterrupted) { 435 TEST_F(DownloadItemTest, RestartAfterInterrupted) {
444 base::CommandLine::ForCurrentProcess()->AppendSwitch( 436 base::CommandLine::ForCurrentProcess()->AppendSwitch(
445 switches::kEnableDownloadResumption); 437 switches::kEnableDownloadResumption);
446 438
447 DownloadItemImpl* item = CreateDownloadItem(); 439 DownloadItemImpl* item = CreateDownloadItem();
448 MockObserver observer(item); 440 TestDownloadItemObserver observer(item);
449 DownloadItemImplDelegate::DownloadTargetCallback callback; 441 DownloadItemImplDelegate::DownloadTargetCallback callback;
450 MockDownloadFile* download_file = 442 MockDownloadFile* download_file =
451 DoIntermediateRename(item, DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS); 443 DoIntermediateRename(item, DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS);
452 444
453 // Interrupt the download, using a restartable interrupt. 445 // Interrupt the download, using a restartable interrupt.
454 EXPECT_CALL(*download_file, Cancel()); 446 EXPECT_CALL(*download_file, Cancel());
455 item->DestinationObserverAsWeakPtr()->DestinationError( 447 item->DestinationObserverAsWeakPtr()->DestinationError(
456 DOWNLOAD_INTERRUPT_REASON_FILE_FAILED); 448 DOWNLOAD_INTERRUPT_REASON_FILE_FAILED);
457 ASSERT_TRUE(observer.CheckUpdated()); 449 ASSERT_TRUE(observer.CheckAndResetUpdated());
458 // Should not try to auto-resume. 450 // Should not try to auto-resume.
459 ASSERT_EQ(1, observer.GetInterruptCount()); 451 ASSERT_EQ(1, observer.GetInterruptCount());
460 ASSERT_EQ(0, observer.GetResumeCount()); 452 ASSERT_EQ(0, observer.GetResumeCount());
461 RunAllPendingInMessageLoops(); 453 RunAllPendingInMessageLoops();
462 454
463 CleanupItem(item, download_file, DownloadItem::INTERRUPTED); 455 CleanupItem(item, download_file, DownloadItem::INTERRUPTED);
464 } 456 }
465 457
466 // Check we do correct cleanup for RESUME_MODE_INVALID interrupts. 458 // Check we do correct cleanup for RESUME_MODE_INVALID interrupts.
467 TEST_F(DownloadItemTest, UnresumableInterrupt) { 459 TEST_F(DownloadItemTest, UnresumableInterrupt) {
468 base::CommandLine::ForCurrentProcess()->AppendSwitch( 460 base::CommandLine::ForCurrentProcess()->AppendSwitch(
469 switches::kEnableDownloadResumption); 461 switches::kEnableDownloadResumption);
470 462
471 DownloadItemImpl* item = CreateDownloadItem(); 463 DownloadItemImpl* item = CreateDownloadItem();
472 MockObserver observer(item); 464 TestDownloadItemObserver observer(item);
473 DownloadItemImplDelegate::DownloadTargetCallback callback; 465 DownloadItemImplDelegate::DownloadTargetCallback callback;
474 MockDownloadFile* download_file = 466 MockDownloadFile* download_file =
475 DoIntermediateRename(item, DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS); 467 DoIntermediateRename(item, DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS);
476 468
477 // Fail final rename with unresumable reason. 469 // Fail final rename with unresumable reason.
478 EXPECT_CALL(*mock_delegate(), ShouldCompleteDownload(item, _)) 470 EXPECT_CALL(*mock_delegate(), ShouldCompleteDownload(item, _))
479 .WillOnce(Return(true)); 471 .WillOnce(Return(true));
480 EXPECT_CALL(*download_file, RenameAndAnnotate(base::FilePath(kDummyPath), _)) 472 EXPECT_CALL(*download_file, RenameAndAnnotate(base::FilePath(kDummyPath), _))
481 .WillOnce(ScheduleRenameCallback(DOWNLOAD_INTERRUPT_REASON_FILE_BLOCKED, 473 .WillOnce(ScheduleRenameCallback(DOWNLOAD_INTERRUPT_REASON_FILE_BLOCKED,
482 base::FilePath(kDummyPath))); 474 base::FilePath(kDummyPath)));
483 EXPECT_CALL(*download_file, Cancel()); 475 EXPECT_CALL(*download_file, Cancel());
484 476
485 // Complete download to trigger final rename. 477 // Complete download to trigger final rename.
486 item->DestinationObserverAsWeakPtr()->DestinationCompleted(std::string()); 478 item->DestinationObserverAsWeakPtr()->DestinationCompleted(std::string());
487 RunAllPendingInMessageLoops(); 479 RunAllPendingInMessageLoops();
488 480
489 ASSERT_TRUE(observer.CheckUpdated()); 481 ASSERT_TRUE(observer.CheckAndResetUpdated());
490 // Should not try to auto-resume. 482 // Should not try to auto-resume.
491 ASSERT_EQ(1, observer.GetInterruptCount()); 483 ASSERT_EQ(1, observer.GetInterruptCount());
492 ASSERT_EQ(0, observer.GetResumeCount()); 484 ASSERT_EQ(0, observer.GetResumeCount());
493 485
494 CleanupItem(item, download_file, DownloadItem::INTERRUPTED); 486 CleanupItem(item, download_file, DownloadItem::INTERRUPTED);
495 } 487 }
496 488
497 TEST_F(DownloadItemTest, LimitRestartsAfterInterrupted) { 489 TEST_F(DownloadItemTest, LimitRestartsAfterInterrupted) {
498 base::CommandLine::ForCurrentProcess()->AppendSwitch( 490 base::CommandLine::ForCurrentProcess()->AppendSwitch(
499 switches::kEnableDownloadResumption); 491 switches::kEnableDownloadResumption);
500 492
501 TestBrowserContext test_browser_context; 493 TestBrowserContext test_browser_context;
502 DownloadItemImpl* item = CreateDownloadItem(); 494 DownloadItemImpl* item = CreateDownloadItem();
503 base::WeakPtr<DownloadDestinationObserver> as_observer( 495 base::WeakPtr<DownloadDestinationObserver> as_observer(
504 item->DestinationObserverAsWeakPtr()); 496 item->DestinationObserverAsWeakPtr());
505 MockObserver observer(item); 497 TestDownloadItemObserver observer(item);
506 MockDownloadFile* mock_download_file(NULL); 498 MockDownloadFile* mock_download_file(NULL);
507 scoped_ptr<DownloadFile> download_file; 499 scoped_ptr<DownloadFile> download_file;
508 MockRequestHandle* mock_request_handle(NULL); 500 MockRequestHandle* mock_request_handle(NULL);
509 scoped_ptr<DownloadRequestHandleInterface> request_handle; 501 scoped_ptr<DownloadRequestHandleInterface> request_handle;
510 DownloadItemImplDelegate::DownloadTargetCallback callback; 502 DownloadItemImplDelegate::DownloadTargetCallback callback;
511 503
512 EXPECT_CALL(*mock_delegate(), DetermineDownloadTarget(item, _)) 504 EXPECT_CALL(*mock_delegate(), DetermineDownloadTarget(item, _))
513 .WillRepeatedly(SaveArg<1>(&callback)); 505 .WillRepeatedly(SaveArg<1>(&callback));
514 EXPECT_CALL(*mock_delegate(), GetBrowserContext()) 506 EXPECT_CALL(*mock_delegate(), GetBrowserContext())
515 .WillRepeatedly(Return(&test_browser_context)); 507 .WillRepeatedly(Return(&test_browser_context));
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
553 } 545 }
554 546
555 CleanupItem(item, mock_download_file, DownloadItem::INTERRUPTED); 547 CleanupItem(item, mock_download_file, DownloadItem::INTERRUPTED);
556 } 548 }
557 549
558 TEST_F(DownloadItemTest, NotificationAfterRemove) { 550 TEST_F(DownloadItemTest, NotificationAfterRemove) {
559 DownloadItemImpl* item = CreateDownloadItem(); 551 DownloadItemImpl* item = CreateDownloadItem();
560 MockDownloadFile* download_file = AddDownloadFileToDownloadItem(item, NULL); 552 MockDownloadFile* download_file = AddDownloadFileToDownloadItem(item, NULL);
561 EXPECT_CALL(*download_file, Cancel()); 553 EXPECT_CALL(*download_file, Cancel());
562 EXPECT_CALL(*mock_delegate(), DownloadRemoved(_)); 554 EXPECT_CALL(*mock_delegate(), DownloadRemoved(_));
563 MockObserver observer(item); 555 TestDownloadItemObserver observer(item);
564 556
565 item->Remove(); 557 item->Remove();
566 ASSERT_TRUE(observer.CheckUpdated()); 558 ASSERT_TRUE(observer.CheckAndResetUpdated());
567 ASSERT_TRUE(observer.CheckRemoved()); 559 ASSERT_TRUE(observer.CheckRemoved());
568 } 560 }
569 561
570 TEST_F(DownloadItemTest, NotificationAfterOnContentCheckCompleted) { 562 TEST_F(DownloadItemTest, NotificationAfterOnContentCheckCompleted) {
571 // Setting to NOT_DANGEROUS does not trigger a notification. 563 // Setting to NOT_DANGEROUS does not trigger a notification.
572 DownloadItemImpl* safe_item = CreateDownloadItem(); 564 DownloadItemImpl* safe_item = CreateDownloadItem();
573 MockObserver safe_observer(safe_item); 565 TestDownloadItemObserver safe_observer(safe_item);
574 566
575 safe_item->OnAllDataSaved(std::string()); 567 safe_item->OnAllDataSaved(std::string());
576 EXPECT_TRUE(safe_observer.CheckUpdated()); 568 EXPECT_TRUE(safe_observer.CheckAndResetUpdated());
577 safe_item->OnContentCheckCompleted(DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS); 569 safe_item->OnContentCheckCompleted(DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS);
578 EXPECT_TRUE(safe_observer.CheckUpdated()); 570 EXPECT_TRUE(safe_observer.CheckAndResetUpdated());
579 571
580 // Setting to unsafe url or unsafe file should trigger a notification. 572 // Setting to unsafe url or unsafe file should trigger a notification.
581 DownloadItemImpl* unsafeurl_item = 573 DownloadItemImpl* unsafeurl_item =
582 CreateDownloadItem(); 574 CreateDownloadItem();
583 MockObserver unsafeurl_observer(unsafeurl_item); 575 TestDownloadItemObserver unsafeurl_observer(unsafeurl_item);
584 576
585 unsafeurl_item->OnAllDataSaved(std::string()); 577 unsafeurl_item->OnAllDataSaved(std::string());
586 EXPECT_TRUE(unsafeurl_observer.CheckUpdated()); 578 EXPECT_TRUE(unsafeurl_observer.CheckAndResetUpdated());
587 unsafeurl_item->OnContentCheckCompleted(DOWNLOAD_DANGER_TYPE_DANGEROUS_URL); 579 unsafeurl_item->OnContentCheckCompleted(DOWNLOAD_DANGER_TYPE_DANGEROUS_URL);
588 EXPECT_TRUE(unsafeurl_observer.CheckUpdated()); 580 EXPECT_TRUE(unsafeurl_observer.CheckAndResetUpdated());
589 581
590 unsafeurl_item->ValidateDangerousDownload(); 582 unsafeurl_item->ValidateDangerousDownload();
591 EXPECT_TRUE(unsafeurl_observer.CheckUpdated()); 583 EXPECT_TRUE(unsafeurl_observer.CheckAndResetUpdated());
592 584
593 DownloadItemImpl* unsafefile_item = 585 DownloadItemImpl* unsafefile_item =
594 CreateDownloadItem(); 586 CreateDownloadItem();
595 MockObserver unsafefile_observer(unsafefile_item); 587 TestDownloadItemObserver unsafefile_observer(unsafefile_item);
596 588
597 unsafefile_item->OnAllDataSaved(std::string()); 589 unsafefile_item->OnAllDataSaved(std::string());
598 EXPECT_TRUE(unsafefile_observer.CheckUpdated()); 590 EXPECT_TRUE(unsafefile_observer.CheckAndResetUpdated());
599 unsafefile_item->OnContentCheckCompleted(DOWNLOAD_DANGER_TYPE_DANGEROUS_FILE); 591 unsafefile_item->OnContentCheckCompleted(DOWNLOAD_DANGER_TYPE_DANGEROUS_FILE);
600 EXPECT_TRUE(unsafefile_observer.CheckUpdated()); 592 EXPECT_TRUE(unsafefile_observer.CheckAndResetUpdated());
601 593
602 unsafefile_item->ValidateDangerousDownload(); 594 unsafefile_item->ValidateDangerousDownload();
603 EXPECT_TRUE(unsafefile_observer.CheckUpdated()); 595 EXPECT_TRUE(unsafefile_observer.CheckAndResetUpdated());
604 } 596 }
605 597
606 // DownloadItemImpl::OnDownloadTargetDetermined will schedule a task to run 598 // DownloadItemImpl::OnDownloadTargetDetermined will schedule a task to run
607 // DownloadFile::Rename(). Once the rename 599 // DownloadFile::Rename(). Once the rename
608 // completes, DownloadItemImpl receives a notification with the new file 600 // completes, DownloadItemImpl receives a notification with the new file
609 // name. Check that observers are updated when the new filename is available and 601 // name. Check that observers are updated when the new filename is available and
610 // not before. 602 // not before.
611 TEST_F(DownloadItemTest, NotificationAfterOnDownloadTargetDetermined) { 603 TEST_F(DownloadItemTest, NotificationAfterOnDownloadTargetDetermined) {
612 DownloadItemImpl* item = CreateDownloadItem(); 604 DownloadItemImpl* item = CreateDownloadItem();
613 DownloadItemImplDelegate::DownloadTargetCallback callback; 605 DownloadItemImplDelegate::DownloadTargetCallback callback;
614 MockDownloadFile* download_file = 606 MockDownloadFile* download_file =
615 AddDownloadFileToDownloadItem(item, &callback); 607 AddDownloadFileToDownloadItem(item, &callback);
616 MockObserver observer(item); 608 TestDownloadItemObserver observer(item);
617 base::FilePath target_path(kDummyPath); 609 base::FilePath target_path(kDummyPath);
618 base::FilePath intermediate_path(target_path.InsertBeforeExtensionASCII("x")); 610 base::FilePath intermediate_path(target_path.InsertBeforeExtensionASCII("x"));
619 base::FilePath new_intermediate_path( 611 base::FilePath new_intermediate_path(
620 target_path.InsertBeforeExtensionASCII("y")); 612 target_path.InsertBeforeExtensionASCII("y"));
621 EXPECT_CALL(*download_file, RenameAndUniquify(intermediate_path, _)) 613 EXPECT_CALL(*download_file, RenameAndUniquify(intermediate_path, _))
622 .WillOnce(ScheduleRenameCallback(DOWNLOAD_INTERRUPT_REASON_NONE, 614 .WillOnce(ScheduleRenameCallback(DOWNLOAD_INTERRUPT_REASON_NONE,
623 new_intermediate_path)); 615 new_intermediate_path));
624 616
625 // Currently, a notification would be generated if the danger type is anything 617 // Currently, a notification would be generated if the danger type is anything
626 // other than NOT_DANGEROUS. 618 // other than NOT_DANGEROUS.
627 callback.Run(target_path, DownloadItem::TARGET_DISPOSITION_OVERWRITE, 619 callback.Run(target_path, DownloadItem::TARGET_DISPOSITION_OVERWRITE,
628 DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, intermediate_path); 620 DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, intermediate_path);
629 EXPECT_FALSE(observer.CheckUpdated()); 621 EXPECT_FALSE(observer.CheckAndResetUpdated());
630 RunAllPendingInMessageLoops(); 622 RunAllPendingInMessageLoops();
631 EXPECT_TRUE(observer.CheckUpdated()); 623 EXPECT_TRUE(observer.CheckAndResetUpdated());
632 EXPECT_EQ(new_intermediate_path, item->GetFullPath()); 624 EXPECT_EQ(new_intermediate_path, item->GetFullPath());
633 625
634 CleanupItem(item, download_file, DownloadItem::IN_PROGRESS); 626 CleanupItem(item, download_file, DownloadItem::IN_PROGRESS);
635 } 627 }
636 628
637 TEST_F(DownloadItemTest, NotificationAfterTogglePause) { 629 TEST_F(DownloadItemTest, NotificationAfterTogglePause) {
638 DownloadItemImpl* item = CreateDownloadItem(); 630 DownloadItemImpl* item = CreateDownloadItem();
639 MockObserver observer(item); 631 TestDownloadItemObserver observer(item);
640 MockDownloadFile* mock_download_file(new MockDownloadFile); 632 MockDownloadFile* mock_download_file(new MockDownloadFile);
641 scoped_ptr<DownloadFile> download_file(mock_download_file); 633 scoped_ptr<DownloadFile> download_file(mock_download_file);
642 scoped_ptr<DownloadRequestHandleInterface> request_handle( 634 scoped_ptr<DownloadRequestHandleInterface> request_handle(
643 new NiceMock<MockRequestHandle>); 635 new NiceMock<MockRequestHandle>);
644 636
645 EXPECT_CALL(*mock_download_file, Initialize(_)); 637 EXPECT_CALL(*mock_download_file, Initialize(_));
646 EXPECT_CALL(*mock_delegate(), DetermineDownloadTarget(_, _)); 638 EXPECT_CALL(*mock_delegate(), DetermineDownloadTarget(_, _));
647 item->Start(download_file.Pass(), request_handle.Pass()); 639 item->Start(download_file.Pass(), request_handle.Pass());
648 640
649 item->Pause(); 641 item->Pause();
650 ASSERT_TRUE(observer.CheckUpdated()); 642 ASSERT_TRUE(observer.CheckAndResetUpdated());
651 643
652 ASSERT_TRUE(item->IsPaused()); 644 ASSERT_TRUE(item->IsPaused());
653 645
654 item->Resume(); 646 item->Resume();
655 ASSERT_TRUE(observer.CheckUpdated()); 647 ASSERT_TRUE(observer.CheckAndResetUpdated());
656 648
657 RunAllPendingInMessageLoops(); 649 RunAllPendingInMessageLoops();
658 650
659 CleanupItem(item, mock_download_file, DownloadItem::IN_PROGRESS); 651 CleanupItem(item, mock_download_file, DownloadItem::IN_PROGRESS);
660 } 652 }
661 653
662 TEST_F(DownloadItemTest, DisplayName) { 654 TEST_F(DownloadItemTest, DisplayName) {
663 DownloadItemImpl* item = CreateDownloadItem(); 655 DownloadItemImpl* item = CreateDownloadItem();
664 DownloadItemImplDelegate::DownloadTargetCallback callback; 656 DownloadItemImplDelegate::DownloadTargetCallback callback;
665 MockDownloadFile* download_file = 657 MockDownloadFile* download_file =
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
896 888
897 EXPECT_FALSE(item->GetFileExternallyRemoved()); 889 EXPECT_FALSE(item->GetFileExternallyRemoved());
898 item->OnDownloadedFileRemoved(); 890 item->OnDownloadedFileRemoved();
899 EXPECT_TRUE(item->GetFileExternallyRemoved()); 891 EXPECT_TRUE(item->GetFileExternallyRemoved());
900 } 892 }
901 893
902 TEST_F(DownloadItemTest, DestinationUpdate) { 894 TEST_F(DownloadItemTest, DestinationUpdate) {
903 DownloadItemImpl* item = CreateDownloadItem(); 895 DownloadItemImpl* item = CreateDownloadItem();
904 base::WeakPtr<DownloadDestinationObserver> as_observer( 896 base::WeakPtr<DownloadDestinationObserver> as_observer(
905 item->DestinationObserverAsWeakPtr()); 897 item->DestinationObserverAsWeakPtr());
906 MockObserver observer(item); 898 TestDownloadItemObserver observer(item);
907 899
908 EXPECT_EQ(0l, item->CurrentSpeed()); 900 EXPECT_EQ(0l, item->CurrentSpeed());
909 EXPECT_EQ("", item->GetHashState()); 901 EXPECT_EQ("", item->GetHashState());
910 EXPECT_EQ(0l, item->GetReceivedBytes()); 902 EXPECT_EQ(0l, item->GetReceivedBytes());
911 EXPECT_EQ(0l, item->GetTotalBytes()); 903 EXPECT_EQ(0l, item->GetTotalBytes());
912 EXPECT_FALSE(observer.CheckUpdated()); 904 EXPECT_FALSE(observer.CheckAndResetUpdated());
913 item->SetTotalBytes(100l); 905 item->SetTotalBytes(100l);
914 EXPECT_EQ(100l, item->GetTotalBytes()); 906 EXPECT_EQ(100l, item->GetTotalBytes());
915 907
916 as_observer->DestinationUpdate(10, 20, "deadbeef"); 908 as_observer->DestinationUpdate(10, 20, "deadbeef");
917 EXPECT_EQ(20l, item->CurrentSpeed()); 909 EXPECT_EQ(20l, item->CurrentSpeed());
918 EXPECT_EQ("deadbeef", item->GetHashState()); 910 EXPECT_EQ("deadbeef", item->GetHashState());
919 EXPECT_EQ(10l, item->GetReceivedBytes()); 911 EXPECT_EQ(10l, item->GetReceivedBytes());
920 EXPECT_EQ(100l, item->GetTotalBytes()); 912 EXPECT_EQ(100l, item->GetTotalBytes());
921 EXPECT_TRUE(observer.CheckUpdated()); 913 EXPECT_TRUE(observer.CheckAndResetUpdated());
922 914
923 as_observer->DestinationUpdate(200, 20, "livebeef"); 915 as_observer->DestinationUpdate(200, 20, "livebeef");
924 EXPECT_EQ(20l, item->CurrentSpeed()); 916 EXPECT_EQ(20l, item->CurrentSpeed());
925 EXPECT_EQ("livebeef", item->GetHashState()); 917 EXPECT_EQ("livebeef", item->GetHashState());
926 EXPECT_EQ(200l, item->GetReceivedBytes()); 918 EXPECT_EQ(200l, item->GetReceivedBytes());
927 EXPECT_EQ(0l, item->GetTotalBytes()); 919 EXPECT_EQ(0l, item->GetTotalBytes());
928 EXPECT_TRUE(observer.CheckUpdated()); 920 EXPECT_TRUE(observer.CheckAndResetUpdated());
929 } 921 }
930 922
931 TEST_F(DownloadItemTest, DestinationError) { 923 TEST_F(DownloadItemTest, DestinationError) {
932 DownloadItemImpl* item = CreateDownloadItem(); 924 DownloadItemImpl* item = CreateDownloadItem();
933 MockDownloadFile* download_file = 925 MockDownloadFile* download_file =
934 DoIntermediateRename(item, DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS); 926 DoIntermediateRename(item, DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS);
935 base::WeakPtr<DownloadDestinationObserver> as_observer( 927 base::WeakPtr<DownloadDestinationObserver> as_observer(
936 item->DestinationObserverAsWeakPtr()); 928 item->DestinationObserverAsWeakPtr());
937 MockObserver observer(item); 929 TestDownloadItemObserver observer(item);
938 930
939 EXPECT_EQ(DownloadItem::IN_PROGRESS, item->GetState()); 931 EXPECT_EQ(DownloadItem::IN_PROGRESS, item->GetState());
940 EXPECT_EQ(DOWNLOAD_INTERRUPT_REASON_NONE, item->GetLastReason()); 932 EXPECT_EQ(DOWNLOAD_INTERRUPT_REASON_NONE, item->GetLastReason());
941 EXPECT_FALSE(observer.CheckUpdated()); 933 EXPECT_FALSE(observer.CheckAndResetUpdated());
942 934
943 EXPECT_CALL(*download_file, Cancel()); 935 EXPECT_CALL(*download_file, Cancel());
944 as_observer->DestinationError( 936 as_observer->DestinationError(
945 DOWNLOAD_INTERRUPT_REASON_FILE_ACCESS_DENIED); 937 DOWNLOAD_INTERRUPT_REASON_FILE_ACCESS_DENIED);
946 mock_delegate()->VerifyAndClearExpectations(); 938 mock_delegate()->VerifyAndClearExpectations();
947 EXPECT_TRUE(observer.CheckUpdated()); 939 EXPECT_TRUE(observer.CheckAndResetUpdated());
948 EXPECT_EQ(DownloadItem::INTERRUPTED, item->GetState()); 940 EXPECT_EQ(DownloadItem::INTERRUPTED, item->GetState());
949 EXPECT_EQ(DOWNLOAD_INTERRUPT_REASON_FILE_ACCESS_DENIED, 941 EXPECT_EQ(DOWNLOAD_INTERRUPT_REASON_FILE_ACCESS_DENIED,
950 item->GetLastReason()); 942 item->GetLastReason());
951 } 943 }
952 944
953 TEST_F(DownloadItemTest, DestinationCompleted) { 945 TEST_F(DownloadItemTest, DestinationCompleted) {
954 DownloadItemImpl* item = CreateDownloadItem(); 946 DownloadItemImpl* item = CreateDownloadItem();
955 base::WeakPtr<DownloadDestinationObserver> as_observer( 947 base::WeakPtr<DownloadDestinationObserver> as_observer(
956 item->DestinationObserverAsWeakPtr()); 948 item->DestinationObserverAsWeakPtr());
957 MockObserver observer(item); 949 TestDownloadItemObserver observer(item);
958 950
959 EXPECT_EQ(DownloadItem::IN_PROGRESS, item->GetState()); 951 EXPECT_EQ(DownloadItem::IN_PROGRESS, item->GetState());
960 EXPECT_EQ("", item->GetHash()); 952 EXPECT_EQ("", item->GetHash());
961 EXPECT_EQ("", item->GetHashState()); 953 EXPECT_EQ("", item->GetHashState());
962 EXPECT_FALSE(item->AllDataSaved()); 954 EXPECT_FALSE(item->AllDataSaved());
963 EXPECT_FALSE(observer.CheckUpdated()); 955 EXPECT_FALSE(observer.CheckAndResetUpdated());
964 956
965 as_observer->DestinationUpdate(10, 20, "deadbeef"); 957 as_observer->DestinationUpdate(10, 20, "deadbeef");
966 EXPECT_TRUE(observer.CheckUpdated()); 958 EXPECT_TRUE(observer.CheckAndResetUpdated());
967 EXPECT_FALSE(observer.CheckUpdated()); // Confirm reset. 959 EXPECT_FALSE(observer.CheckAndResetUpdated()); // Confirm reset.
968 EXPECT_EQ(DownloadItem::IN_PROGRESS, item->GetState()); 960 EXPECT_EQ(DownloadItem::IN_PROGRESS, item->GetState());
969 EXPECT_EQ("", item->GetHash()); 961 EXPECT_EQ("", item->GetHash());
970 EXPECT_EQ("deadbeef", item->GetHashState()); 962 EXPECT_EQ("deadbeef", item->GetHashState());
971 EXPECT_FALSE(item->AllDataSaved()); 963 EXPECT_FALSE(item->AllDataSaved());
972 964
973 as_observer->DestinationCompleted("livebeef"); 965 as_observer->DestinationCompleted("livebeef");
974 mock_delegate()->VerifyAndClearExpectations(); 966 mock_delegate()->VerifyAndClearExpectations();
975 EXPECT_EQ(DownloadItem::IN_PROGRESS, item->GetState()); 967 EXPECT_EQ(DownloadItem::IN_PROGRESS, item->GetState());
976 EXPECT_TRUE(observer.CheckUpdated()); 968 EXPECT_TRUE(observer.CheckAndResetUpdated());
977 EXPECT_EQ("livebeef", item->GetHash()); 969 EXPECT_EQ("livebeef", item->GetHash());
978 EXPECT_EQ("", item->GetHashState()); 970 EXPECT_EQ("", item->GetHashState());
979 EXPECT_TRUE(item->AllDataSaved()); 971 EXPECT_TRUE(item->AllDataSaved());
980 } 972 }
981 973
982 TEST_F(DownloadItemTest, EnabledActionsForNormalDownload) { 974 TEST_F(DownloadItemTest, EnabledActionsForNormalDownload) {
983 DownloadItemImpl* item = CreateDownloadItem(); 975 DownloadItemImpl* item = CreateDownloadItem();
984 MockDownloadFile* download_file = 976 MockDownloadFile* download_file =
985 DoIntermediateRename(item, DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS); 977 DoIntermediateRename(item, DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS);
986 978
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
1294 base::Unretained(&returned_path))); 1286 base::Unretained(&returned_path)));
1295 RunAllPendingInMessageLoops(); 1287 RunAllPendingInMessageLoops();
1296 EXPECT_TRUE(returned_path.empty()); 1288 EXPECT_TRUE(returned_path.empty());
1297 } 1289 }
1298 1290
1299 TEST(MockDownloadItem, Compiles) { 1291 TEST(MockDownloadItem, Compiles) {
1300 MockDownloadItem mock_item; 1292 MockDownloadItem mock_item;
1301 } 1293 }
1302 1294
1303 } // namespace content 1295 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698