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

Unified 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: rewrite Created 9 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/download/download_query.cc ('k') | content/content_browser.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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());
+}
« no previous file with comments | « content/browser/download/download_query.cc ('k') | content/content_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698