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

Unified Diff: components/download/internal/test/entry_utils.cc

Issue 2870753003: Add a Model to the download component. (Closed)
Patch Set: Renamed test base class Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: components/download/internal/test/entry_utils.cc
diff --git a/components/download/internal/test/entry_utils.cc b/components/download/internal/test/entry_utils.cc
new file mode 100644
index 0000000000000000000000000000000000000000..33b4abfc5a57933e1bb07b2231f2df67b732d291
--- /dev/null
+++ b/components/download/internal/test/entry_utils.cc
@@ -0,0 +1,35 @@
+// Copyright 2017 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 <algorithm>
+
+#include "components/download/internal/test/entry_utils.h"
+
+namespace download {
+namespace test {
+
+bool SuperficialEntryCompare(const Entry* const& expected,
+ const Entry* const& actual) {
+ if (expected == nullptr || actual == nullptr)
+ return expected == actual;
+
+ return expected->client == actual->client && expected->guid == actual->guid &&
+ expected->state == actual->state;
+}
+
+bool SuperficialEntryListCompare(const std::vector<Entry*>& expected,
+ const std::vector<Entry*>& actual) {
+ return std::is_permutation(actual.cbegin(), actual.cend(), expected.cbegin(),
+ SuperficialEntryCompare);
+}
+
+Entry BuildEntry(DownloadClient client, const std::string& guid) {
+ Entry entry;
+ entry.client = client;
+ entry.guid = guid;
+ return entry;
+}
+
+} // namespace test
+} // namespace download
« no previous file with comments | « components/download/internal/test/entry_utils.h ('k') | components/download/internal/test/mock_model_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698