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

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

Issue 2881173003: Download Service : Added leveldb proto layer (Closed)
Patch Set: More unittests 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
index 33b4abfc5a57933e1bb07b2231f2df67b732d291..066c1a0fb1518a1af47f345d4056187d7d21c8ae 100644
--- a/components/download/internal/test/entry_utils.cc
+++ b/components/download/internal/test/entry_utils.cc
@@ -15,15 +15,37 @@ bool SuperficialEntryCompare(const Entry* const& expected,
return expected == actual;
return expected->client == actual->client && expected->guid == actual->guid &&
+ expected->scheduling_params.cancel_time ==
+ actual->scheduling_params.cancel_time &&
+ expected->scheduling_params.network_requirements ==
+ actual->scheduling_params.network_requirements &&
+ expected->scheduling_params.battery_requirements ==
+ actual->scheduling_params.battery_requirements &&
+ expected->scheduling_params.priority ==
+ actual->scheduling_params.priority &&
+ expected->request_params.url == actual->request_params.url &&
+ expected->request_params.method == actual->request_params.method &&
+ expected->request_params.request_headers.ToString() ==
+ actual->request_params.request_headers.ToString() &&
expected->state == actual->state;
}
-bool SuperficialEntryListCompare(const std::vector<Entry*>& expected,
- const std::vector<Entry*>& actual) {
+bool CompareEntry(const Entry& expected, const Entry& actual) {
+ return SuperficialEntryCompare(&expected, &actual);
+}
+
+bool CompareEntryList(const std::vector<Entry*>& expected,
+ const std::vector<Entry*>& actual) {
return std::is_permutation(actual.cbegin(), actual.cend(), expected.cbegin(),
SuperficialEntryCompare);
}
+bool CompareEntryList(const std::vector<Entry>& list1,
+ const std::vector<Entry>& list2) {
+ return std::is_permutation(list1.begin(), list1.end(), list2.begin(),
+ CompareEntry);
+}
+
Entry BuildEntry(DownloadClient client, const std::string& guid) {
Entry entry;
entry.client = client;
@@ -31,5 +53,27 @@ Entry BuildEntry(DownloadClient client, const std::string& guid) {
return entry;
}
+Entry BuildEntry(DownloadClient client,
+ const std::string& guid,
+ base::Time cancel_time,
+ SchedulingParams::NetworkRequirements network_requirements,
+ SchedulingParams::BatteryRequirements battery_requirements,
+ SchedulingParams::Priority priority,
+ const GURL& url,
+ const std::string& request_method,
+ Entry::State state) {
+ Entry entry;
David Trainor- moved to gerrit 2017/05/18 19:41:00 Call BuildEntry(client, guid) and then set the res
shaktisahu 2017/05/19 04:54:57 Done.
+ entry.client = client;
+ entry.guid = guid;
+ entry.scheduling_params.cancel_time = cancel_time;
+ entry.scheduling_params.network_requirements = network_requirements;
+ entry.scheduling_params.battery_requirements = battery_requirements;
+ entry.scheduling_params.priority = priority;
+ entry.request_params.url = url;
+ entry.request_params.method = request_method;
+ entry.state = state;
+ return entry;
+}
+
} // namespace test
} // namespace download

Powered by Google App Engine
This is Rietveld 408576698