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

Unified Diff: components/data_reduction_proxy/content/browser/content_lofi_decider_unittest.cc

Issue 2873793002: Record Data Savings for Client-Side LoFi (Closed)
Patch Set: fix crash in DRPNetworkDelegate when lofi_ui_service is null. 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/data_reduction_proxy/content/browser/content_lofi_decider_unittest.cc
diff --git a/components/data_reduction_proxy/content/browser/content_lofi_decider_unittest.cc b/components/data_reduction_proxy/content/browser/content_lofi_decider_unittest.cc
index 46f5ee2ac8c89b872acc7541eb7ece292a657e9c..9405f8dcebf222f527961ac179e1b9a2a6afe548 100644
--- a/components/data_reduction_proxy/content/browser/content_lofi_decider_unittest.cc
+++ b/components/data_reduction_proxy/content/browser/content_lofi_decider_unittest.cc
@@ -818,4 +818,32 @@ TEST_F(ContentLoFiDeciderTest, RequestIsClientSideLoFiImageTest) {
EXPECT_TRUE(lofi_decider->IsClientLoFiImageRequest(*request));
}
+TEST_F(ContentLoFiDeciderTest, RequestIsClientLoFiAutoReload) {
+ // IsClientLoFiAutoReloadRequest() should return true for any request with the
+ // CLIENT_LOFI_AUTO_RELOAD bit set.
+
+ EXPECT_TRUE(ContentLoFiDecider().IsClientLoFiAutoReloadRequest(
+ *CreateRequestByType(content::RESOURCE_TYPE_IMAGE, false,
+ content::CLIENT_LOFI_AUTO_RELOAD)));
+
+ EXPECT_TRUE(
+ ContentLoFiDecider().IsClientLoFiAutoReloadRequest(*CreateRequestByType(
+ content::RESOURCE_TYPE_IMAGE, true,
+ content::CLIENT_LOFI_AUTO_RELOAD | content::PREVIEWS_NO_TRANSFORM)));
+
+ EXPECT_TRUE(ContentLoFiDecider().IsClientLoFiAutoReloadRequest(
+ *CreateRequestByType(content::RESOURCE_TYPE_MAIN_FRAME, true,
+ content::CLIENT_LOFI_AUTO_RELOAD)));
+
+ EXPECT_TRUE(ContentLoFiDecider().IsClientLoFiAutoReloadRequest(
+ *CreateRequestByType(content::RESOURCE_TYPE_SCRIPT, true,
+ content::CLIENT_LOFI_AUTO_RELOAD)));
+
+ // IsClientLoFiAutoReloadRequest() should return false for any request without
+ // the CLIENT_LOFI_AUTO_RELOAD bit set.
+ EXPECT_FALSE(ContentLoFiDecider().IsClientLoFiAutoReloadRequest(
+ *CreateRequestByType(content::RESOURCE_TYPE_IMAGE, false,
+ content::PREVIEWS_NO_TRANSFORM)));
+}
+
} // namespace data_reduction_proxy

Powered by Google App Engine
This is Rietveld 408576698