| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/callback.h" | 6 #include "base/callback.h" |
| 7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 return download_history_.get(); | 80 return download_history_.get(); |
| 81 } | 81 } |
| 82 | 82 |
| 83 // The test fixture: | 83 // The test fixture: |
| 84 class DownloadUIControllerTest : public ChromeRenderViewHostTestHarness { | 84 class DownloadUIControllerTest : public ChromeRenderViewHostTestHarness { |
| 85 public: | 85 public: |
| 86 DownloadUIControllerTest(); | 86 DownloadUIControllerTest(); |
| 87 | 87 |
| 88 protected: | 88 protected: |
| 89 // testing::Test | 89 // testing::Test |
| 90 virtual void SetUp() override; | 90 void SetUp() override; |
| 91 | 91 |
| 92 // Returns a TestDelegate. Invoking OnNewDownloadReady on the returned | 92 // Returns a TestDelegate. Invoking OnNewDownloadReady on the returned |
| 93 // delegate results in the DownloadItem* being stored in |notified_item_|. | 93 // delegate results in the DownloadItem* being stored in |notified_item_|. |
| 94 scoped_ptr<DownloadUIController::Delegate> GetTestDelegate(); | 94 scoped_ptr<DownloadUIController::Delegate> GetTestDelegate(); |
| 95 | 95 |
| 96 MockDownloadManager* manager() { return manager_.get(); } | 96 MockDownloadManager* manager() { return manager_.get(); } |
| 97 | 97 |
| 98 // Returns the DownloadManager::Observer registered by a test case. This is | 98 // Returns the DownloadManager::Observer registered by a test case. This is |
| 99 // the DownloadUIController's observer for all current test cases. | 99 // the DownloadUIController's observer for all current test cases. |
| 100 content::DownloadManager::Observer* manager_observer() { | 100 content::DownloadManager::Observer* manager_observer() { |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 // DownloadUIController. It should ignore the download since it's marked as | 337 // DownloadUIController. It should ignore the download since it's marked as |
| 338 // being restored from history. | 338 // being restored from history. |
| 339 ASSERT_TRUE(manager_observer()); | 339 ASSERT_TRUE(manager_observer()); |
| 340 manager_observer()->OnDownloadCreated(manager(), item.get()); | 340 manager_observer()->OnDownloadCreated(manager(), item.get()); |
| 341 | 341 |
| 342 // Finally, the expectation we've been waiting for: | 342 // Finally, the expectation we've been waiting for: |
| 343 EXPECT_FALSE(notified_item()); | 343 EXPECT_FALSE(notified_item()); |
| 344 } | 344 } |
| 345 | 345 |
| 346 } // namespace | 346 } // namespace |
| OLD | NEW |