| 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_path.h" | 5 #include "base/file_path.h" |
| 6 #include "base/file_util.h" | 6 #include "base/file_util.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.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/observer_list.h" | 10 #include "base/observer_list.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 using testing::AnyNumber; | 23 using testing::AnyNumber; |
| 24 using testing::Return; | 24 using testing::Return; |
| 25 using testing::ReturnRef; | 25 using testing::ReturnRef; |
| 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 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_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 { |
| (...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 item->UpdateObservers(); | 417 item->UpdateObservers(); |
| 418 message_loop_.RunUntilIdle(); | 418 message_loop_.RunUntilIdle(); |
| 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_.RunUntilIdle(); | 424 message_loop_.RunUntilIdle(); |
| 425 EXPECT_FALSE(IsPathInUse(new_target_path)); | 425 EXPECT_FALSE(IsPathInUse(new_target_path)); |
| 426 } | 426 } |
| OLD | NEW |