Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(340)

Side by Side Diff: content/browser/download/download_query_unittest.cc

Issue 7825035: Implement chrome.experimental.downloads.search() (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: merge Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "base/stl_util.h"
6 #include "content/browser/download/download_query.h"
7 #include "testing/gtest/include/gtest/gtest.h"
8
9 using download_util::DownloadQuery;
10
11 class MockDownloadItem : public DownloadItemInterface {
12 public:
13 };
14
15 class DownloadQueryTest : public testing::Test {
16 public:
17 DownloadQueryTest() {}
18 virtual ~DownloadQueryTest() {}
19 virtual void TearDown() {
20 STLDeleteElements(&all_items_);
21 }
22 DownloadQuery* query() { return &query_; }
23 DownloadQuery::DownloadItems* all_items() { return &all_items_; }
24 DownloadQuery::DownloadItems* results() { return &results; }
25 void Search() {
26 query()->Search(all_items_, &results_);
27 }
28
29 private:
30 DownloadQuery query_;
31 DownloadQuery::DownloadItems all_items_;
32 DownloadQuery::DownloadItems results_;
33
34 DISALLOW_COPY_AND_ASSIGN(DownloadQueryTest);
35 };
36
37 TEST_F(DownloadQueryTest, EmptyQueryNoItems) {
38 Search();
39 EXPECT_EQ(0, results()->size());
40 }
41
42 TEST_F(DownloadQueryTest, EmptyQuerySomeItems) {
43 all_items()->push_back(new MockDownloadItem(0));
44 all_items()->push_back(new MockDownloadItem(1));
45 all_items()->push_back(new MockDownloadItem(2));
46 Search();
47 EXPECT_EQ(3, results()->size());
48 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698