| 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/files/file_path.h" | 5 #include "base/files/file_path.h" |
| 6 #include "base/memory/ref_counted.h" | 6 #include "base/memory/ref_counted.h" |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
| 9 #include "chrome/browser/download/download_ui_controller.h" | 9 #include "chrome/browser/download/download_ui_controller.h" |
| 10 #include "content/public/test/mock_download_item.h" | 10 #include "content/public/test/mock_download_item.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 virtual void NotifyDownloadStarting(content::DownloadItem* item) OVERRIDE; | 34 virtual void NotifyDownloadStarting(content::DownloadItem* item) OVERRIDE; |
| 35 | 35 |
| 36 base::WeakPtr<content::DownloadItem*> receiver_; | 36 base::WeakPtr<content::DownloadItem*> receiver_; |
| 37 }; | 37 }; |
| 38 | 38 |
| 39 TestDelegate::TestDelegate(base::WeakPtr<content::DownloadItem*> receiver) | 39 TestDelegate::TestDelegate(base::WeakPtr<content::DownloadItem*> receiver) |
| 40 : receiver_(receiver) { | 40 : receiver_(receiver) { |
| 41 } | 41 } |
| 42 | 42 |
| 43 void TestDelegate::NotifyDownloadStarting(content::DownloadItem* item) { | 43 void TestDelegate::NotifyDownloadStarting(content::DownloadItem* item) { |
| 44 if (receiver_) | 44 if (receiver_.get()) |
| 45 *receiver_ = item; | 45 *receiver_ = item; |
| 46 } | 46 } |
| 47 | 47 |
| 48 class DownloadUIControllerTest : public testing::Test { | 48 class DownloadUIControllerTest : public testing::Test { |
| 49 public: | 49 public: |
| 50 DownloadUIControllerTest(); | 50 DownloadUIControllerTest(); |
| 51 | 51 |
| 52 protected: | 52 protected: |
| 53 // testing::Test | 53 // testing::Test |
| 54 virtual void SetUp() OVERRIDE; | 54 virtual void SetUp() OVERRIDE; |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 | 165 |
| 166 ASSERT_TRUE(manager_observer()); | 166 ASSERT_TRUE(manager_observer()); |
| 167 manager_observer()->OnDownloadCreated(manager(), item.get()); | 167 manager_observer()->OnDownloadCreated(manager(), item.get()); |
| 168 EXPECT_FALSE(received_item()); | 168 EXPECT_FALSE(received_item()); |
| 169 | 169 |
| 170 item_observer()->OnDownloadUpdated(item.get()); | 170 item_observer()->OnDownloadUpdated(item.get()); |
| 171 EXPECT_FALSE(received_item()); | 171 EXPECT_FALSE(received_item()); |
| 172 } | 172 } |
| 173 | 173 |
| 174 } // namespace | 174 } // namespace |
| OLD | NEW |