| Index: content/browser/download/download_query_unittest.cc
|
| diff --git a/content/browser/download/download_query_unittest.cc b/content/browser/download/download_query_unittest.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..f7e6eeeac04e92f42bbe4a7a8a9b48e510153478
|
| --- /dev/null
|
| +++ b/content/browser/download/download_query_unittest.cc
|
| @@ -0,0 +1,53 @@
|
| +// Copyright (c) 2011 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "base/stl_util.h"
|
| +#include "content/browser/download/download_query.h"
|
| +#include "testing/gtest/include/gtest/gtest.h"
|
| +
|
| +using download_util::DownloadQuery;
|
| +typedef DownloadQuery::DownloadVector DownloadVector;
|
| +
|
| +#if 0
|
| +class MockDownloadItem : public DownloadItemInterface {
|
| + public:
|
| +};
|
| +#endif
|
| +
|
| +class DownloadQueryTest : public testing::Test {
|
| + public:
|
| + DownloadQueryTest() {}
|
| + virtual ~DownloadQueryTest() {}
|
| + virtual void TearDown() {
|
| + STLDeleteElements(&all_items_);
|
| + }
|
| + DownloadQuery* query() { return &query_; }
|
| + DownloadVector* all_items() { return &all_items_; }
|
| + DownloadVector* results() { return &results_; }
|
| + void Search() {
|
| + query()->Search(all_items_.begin(), all_items_.end(), &results_);
|
| + }
|
| +
|
| + private:
|
| + DownloadQuery query_;
|
| + DownloadVector all_items_;
|
| + DownloadVector results_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(DownloadQueryTest);
|
| +};
|
| +
|
| +TEST_F(DownloadQueryTest, EmptyQueryNoItems) {
|
| + Search();
|
| + EXPECT_EQ(0U, results()->size());
|
| +}
|
| +
|
| +TEST_F(DownloadQueryTest, EmptyQuerySomeItems) {
|
| +#if 0
|
| + all_items()->push_back(new MockDownloadItem(0));
|
| + all_items()->push_back(new MockDownloadItem(1));
|
| + all_items()->push_back(new MockDownloadItem(2));
|
| +#endif
|
| + Search();
|
| + EXPECT_EQ(3U, results()->size());
|
| +}
|
|
|