OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "chrome/browser/ui/webui/md_downloads/downloads_list_tracker.h" | 5 #include "chrome/browser/ui/webui/md_downloads/downloads_list_tracker.h" |
6 | 6 |
7 #include <limits.h> | 7 #include <limits.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 }; | 91 }; |
92 | 92 |
93 // A fixture to test DownloadsListTracker. | 93 // A fixture to test DownloadsListTracker. |
94 class DownloadsListTrackerTest : public testing::Test { | 94 class DownloadsListTrackerTest : public testing::Test { |
95 public: | 95 public: |
96 DownloadsListTrackerTest() {} | 96 DownloadsListTrackerTest() {} |
97 | 97 |
98 ~DownloadsListTrackerTest() override { | 98 ~DownloadsListTrackerTest() override { |
99 for (auto* mock_item : mock_items_) | 99 for (auto* mock_item : mock_items_) |
100 testing::Mock::VerifyAndClear(mock_item); | 100 testing::Mock::VerifyAndClear(mock_item); |
101 STLDeleteElements(&mock_items_); | 101 base::STLDeleteElements(&mock_items_); |
102 } | 102 } |
103 | 103 |
104 // testing::Test: | 104 // testing::Test: |
105 void SetUp() override { | 105 void SetUp() override { |
106 ON_CALL(manager_, GetBrowserContext()).WillByDefault(Return(&profile_)); | 106 ON_CALL(manager_, GetBrowserContext()).WillByDefault(Return(&profile_)); |
107 ON_CALL(manager_, GetAllDownloads(_)).WillByDefault( | 107 ON_CALL(manager_, GetAllDownloads(_)).WillByDefault( |
108 testing::Invoke(this, &DownloadsListTrackerTest::GetAllDownloads)); | 108 testing::Invoke(this, &DownloadsListTrackerTest::GetAllDownloads)); |
109 } | 109 } |
110 | 110 |
111 MockDownloadItem* CreateMock(uint64_t id, const base::Time& started) { | 111 MockDownloadItem* CreateMock(uint64_t id, const base::Time& started) { |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 EXPECT_EQ(1u, GetIds(*web_ui()->call_data()[0]->arg2()).size()); | 349 EXPECT_EQ(1u, GetIds(*web_ui()->call_data()[0]->arg2()).size()); |
350 | 350 |
351 DownloadItemModel(unsent_item).SetShouldShowInShelf(false); | 351 DownloadItemModel(unsent_item).SetShouldShowInShelf(false); |
352 tracker()->OnDownloadUpdated(manager(), unsent_item); | 352 tracker()->OnDownloadUpdated(manager(), unsent_item); |
353 EXPECT_EQ(1u, web_ui()->call_data().size()); | 353 EXPECT_EQ(1u, web_ui()->call_data().size()); |
354 | 354 |
355 DownloadItemModel(unsent_item).SetShouldShowInShelf(true); | 355 DownloadItemModel(unsent_item).SetShouldShowInShelf(true); |
356 tracker()->OnDownloadUpdated(manager(), unsent_item); | 356 tracker()->OnDownloadUpdated(manager(), unsent_item); |
357 EXPECT_EQ(1u, web_ui()->call_data().size()); | 357 EXPECT_EQ(1u, web_ui()->call_data().size()); |
358 } | 358 } |
OLD | NEW |