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

Side by Side Diff: chrome/browser/download/download_path_reservation_tracker_unittest.cc

Issue 10665049: Make DownloadHistory observe manager, items (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 4 months 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 | Annotate | Revision Log
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/file_path.h" 5 #include "base/file_path.h"
6 #include "base/file_util.h" 6 #include "base/file_util.h"
7 #include "base/memory/weak_ptr.h" 7 #include "base/memory/weak_ptr.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/observer_list.h" 9 #include "base/observer_list.h"
10 #include "base/scoped_temp_dir.h" 10 #include "base/scoped_temp_dir.h"
(...skipping 15 matching lines...) Expand all
26 using testing::ReturnRefOfCopy; 26 using testing::ReturnRefOfCopy;
27 27
28 namespace { 28 namespace {
29 29
30 // MockDownloadItem with real observers and state. 30 // MockDownloadItem with real observers and state.
31 class FakeDownloadItem : public MockDownloadItem { 31 class FakeDownloadItem : public MockDownloadItem {
32 public: 32 public:
33 explicit FakeDownloadItem() 33 explicit FakeDownloadItem()
34 : state_(IN_PROGRESS) { 34 : state_(IN_PROGRESS) {
35 } 35 }
36 ~FakeDownloadItem() { 36 virtual ~FakeDownloadItem() {
37 SetState(REMOVING); 37 FOR_EACH_OBSERVER(Observer, observers_, OnDownloadDestroyed(this));
38 EXPECT_EQ(0u, observers_.size()); 38 EXPECT_EQ(0u, observers_.size());
39 } 39 }
40 virtual void AddObserver(Observer* observer) OVERRIDE { 40 virtual void AddObserver(Observer* observer) OVERRIDE {
41 observers_.AddObserver(observer); 41 observers_.AddObserver(observer);
42 } 42 }
43 virtual void RemoveObserver(Observer* observer) OVERRIDE { 43 virtual void RemoveObserver(Observer* observer) OVERRIDE {
44 observers_.RemoveObserver(observer); 44 observers_.RemoveObserver(observer);
45 } 45 }
46 virtual void UpdateObservers() OVERRIDE { 46 virtual void UpdateObservers() OVERRIDE {
47 FOR_EACH_OBSERVER(Observer, observers_, OnDownloadUpdated(this)); 47 FOR_EACH_OBSERVER(Observer, observers_, OnDownloadUpdated(this));
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 item->UpdateObservers(); 417 item->UpdateObservers();
418 message_loop_.RunAllPending(); 418 message_loop_.RunAllPending();
419 EXPECT_FALSE(IsPathInUse(path)); 419 EXPECT_FALSE(IsPathInUse(path));
420 EXPECT_TRUE(IsPathInUse(new_target_path)); 420 EXPECT_TRUE(IsPathInUse(new_target_path));
421 421
422 // Destroying the item should release the reservation. 422 // Destroying the item should release the reservation.
423 item.reset(); 423 item.reset();
424 message_loop_.RunAllPending(); 424 message_loop_.RunAllPending();
425 EXPECT_FALSE(IsPathInUse(new_target_path)); 425 EXPECT_FALSE(IsPathInUse(new_target_path));
426 } 426 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698