| OLD | NEW |
| (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 typedef DownloadQuery::DownloadVector DownloadVector; |
| 11 |
| 12 #if 0 |
| 13 class MockDownloadItem : public DownloadItemInterface { |
| 14 public: |
| 15 }; |
| 16 #endif |
| 17 |
| 18 class DownloadQueryTest : public testing::Test { |
| 19 public: |
| 20 DownloadQueryTest() {} |
| 21 virtual ~DownloadQueryTest() {} |
| 22 virtual void TearDown() { |
| 23 STLDeleteElements(&all_items_); |
| 24 } |
| 25 DownloadQuery* query() { return &query_; } |
| 26 DownloadVector* all_items() { return &all_items_; } |
| 27 DownloadVector* results() { return &results_; } |
| 28 void Search() { |
| 29 query()->Search(all_items_.begin(), all_items_.end(), &results_); |
| 30 } |
| 31 |
| 32 private: |
| 33 DownloadQuery query_; |
| 34 DownloadVector all_items_; |
| 35 DownloadVector results_; |
| 36 |
| 37 DISALLOW_COPY_AND_ASSIGN(DownloadQueryTest); |
| 38 }; |
| 39 |
| 40 TEST_F(DownloadQueryTest, EmptyQueryNoItems) { |
| 41 Search(); |
| 42 EXPECT_EQ(0U, results()->size()); |
| 43 } |
| 44 |
| 45 TEST_F(DownloadQueryTest, EmptyQuerySomeItems) { |
| 46 #if 0 |
| 47 all_items()->push_back(new MockDownloadItem(0)); |
| 48 all_items()->push_back(new MockDownloadItem(1)); |
| 49 all_items()->push_back(new MockDownloadItem(2)); |
| 50 #endif |
| 51 Search(); |
| 52 EXPECT_EQ(3U, results()->size()); |
| 53 } |
| OLD | NEW |