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 <set> | 5 #include <set> |
6 #include <vector> | 6 #include <vector> |
7 | 7 |
8 #include "base/rand_util.h" | 8 #include "base/rand_util.h" |
9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
10 #include "chrome/browser/download/download_history.h" | 10 #include "chrome/browser/download/download_history.h" |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 scoped_ptr<InfoVector> expect_query_downloads_; | 191 scoped_ptr<InfoVector> expect_query_downloads_; |
192 HandleSet remove_downloads_; | 192 HandleSet remove_downloads_; |
193 history::DownloadRow create_download_info_; | 193 history::DownloadRow create_download_info_; |
194 | 194 |
195 DISALLOW_COPY_AND_ASSIGN(FakeHistoryAdapter); | 195 DISALLOW_COPY_AND_ASSIGN(FakeHistoryAdapter); |
196 }; | 196 }; |
197 | 197 |
198 class DownloadHistoryTest : public testing::Test { | 198 class DownloadHistoryTest : public testing::Test { |
199 public: | 199 public: |
200 DownloadHistoryTest() | 200 DownloadHistoryTest() |
201 : ui_thread_(content::BrowserThread::UI, &loop_), | 201 : ui_thread_(content::BrowserThread::UI, &loop_), |
202 manager_(new content::MockDownloadManager()), | 202 manager_(new content::MockDownloadManager()), |
203 history_(NULL), | 203 history_(NULL), |
204 download_history_(NULL), | 204 manager_observer_(NULL), |
205 manager_observer_(NULL), | 205 item_observer_(NULL), |
206 item_observer_(NULL), | 206 download_created_index_(0) {} |
207 download_created_index_(0) { | |
208 } | |
209 virtual ~DownloadHistoryTest() { | 207 virtual ~DownloadHistoryTest() { |
210 STLDeleteElements(&items_); | 208 STLDeleteElements(&items_); |
211 } | 209 } |
212 | 210 |
213 protected: | 211 protected: |
214 virtual void TearDown() OVERRIDE { | 212 virtual void TearDown() OVERRIDE { |
215 download_history_.reset(); | 213 download_history_.reset(); |
216 } | 214 } |
217 | 215 |
218 content::MockDownloadManager& manager() { return *manager_.get(); } | 216 content::MockDownloadManager& manager() { return *manager_.get(); } |
(...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
803 item_observer()->OnDownloadUpdated(&item(0)); | 801 item_observer()->OnDownloadUpdated(&item(0)); |
804 | 802 |
805 FinishCreateDownload(); | 803 FinishCreateDownload(); |
806 EXPECT_TRUE(DownloadHistory::IsPersisted(&item(0))); | 804 EXPECT_TRUE(DownloadHistory::IsPersisted(&item(0))); |
807 | 805 |
808 // ItemAdded should call OnDownloadUpdated, which should detect that the item | 806 // ItemAdded should call OnDownloadUpdated, which should detect that the item |
809 // changed while it was being added and call UpdateDownload immediately. | 807 // changed while it was being added and call UpdateDownload immediately. |
810 info.opened = true; | 808 info.opened = true; |
811 ExpectDownloadUpdated(info); | 809 ExpectDownloadUpdated(info); |
812 } | 810 } |
OLD | NEW |