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 "base/file_util.h" | 5 #include "base/file_util.h" |
6 #include "base/files/file_path.h" | 6 #include "base/files/file_path.h" |
7 #include "base/files/scoped_temp_dir.h" | 7 #include "base/files/scoped_temp_dir.h" |
8 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/observer_list.h" | 10 #include "base/observer_list.h" |
(...skipping 17 matching lines...) Expand all Loading... |
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 virtual ~FakeDownloadItem() { | 36 virtual ~FakeDownloadItem() { |
37 FOR_EACH_OBSERVER(Observer, observers_, OnDownloadDestroyed(this)); | 37 FOR_EACH_OBSERVER(Observer, observers_, OnDownloadDestroyed(this)); |
38 EXPECT_EQ(0u, observers_.size()); | 38 EXPECT_FALSE(observers_.might_have_observers()); |
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)); |
48 } | 48 } |
(...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
691 create_directory, | 691 create_directory, |
692 conflict_action, | 692 conflict_action, |
693 &reserved_path, | 693 &reserved_path, |
694 &verified); | 694 &verified); |
695 // We cannot truncate a path with very long extension. | 695 // We cannot truncate a path with very long extension. |
696 EXPECT_FALSE(verified); | 696 EXPECT_FALSE(verified); |
697 item->SetState(DownloadItem::COMPLETE); | 697 item->SetState(DownloadItem::COMPLETE); |
698 } | 698 } |
699 | 699 |
700 #endif | 700 #endif |
OLD | NEW |