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

Unified Diff: components/previews/core/previews_io_data_unittest.cc

Issue 2563493002: Disallow showing offline previews on a reload. (Closed)
Patch Set: tbansal comments Created 4 years 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 | « components/previews/core/previews_io_data.cc ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/previews/core/previews_io_data_unittest.cc
diff --git a/components/previews/core/previews_io_data_unittest.cc b/components/previews/core/previews_io_data_unittest.cc
index cb8d3aa19447238a04b86066a0e5867c0158bc32..39a8925e618e6667060a5207f816ae47e89a35be 100644
--- a/components/previews/core/previews_io_data_unittest.cc
+++ b/components/previews/core/previews_io_data_unittest.cc
@@ -25,6 +25,7 @@
#include "components/previews/core/previews_opt_out_store.h"
#include "components/previews/core/previews_ui_service.h"
#include "components/variations/variations_associated_data.h"
+#include "net/base/load_flags.h"
#include "net/nqe/effective_connection_type.h"
#include "net/nqe/network_quality_estimator_test_util.h"
#include "net/url_request/url_request.h"
@@ -212,12 +213,21 @@ TEST_F(PreviewsIODataTest, TestShouldAllowPreview) {
network_quality_estimator.set_effective_connection_type(
net::EFFECTIVE_CONNECTION_TYPE_SLOW_2G);
+ request->SetLoadFlags(net::LOAD_BYPASS_CACHE);
+ EXPECT_FALSE(io_data()->ShouldAllowPreview(*request, PreviewsType::OFFLINE));
+ histogram_tester.ExpectBucketCount(
+ "Previews.EligibilityReason.Offline",
+ static_cast<int>(
+ PreviewsEligibilityReason::RELOAD_DISALLOWED_FOR_OFFLINE),
+ 1);
+
+ request->SetLoadFlags(0);
EXPECT_TRUE(io_data()->ShouldAllowPreview(*request, PreviewsType::OFFLINE));
histogram_tester.ExpectBucketCount(
"Previews.EligibilityReason.Offline",
static_cast<int>(PreviewsEligibilityReason::ALLOWED), 1);
- histogram_tester.ExpectTotalCount("Previews.EligibilityReason.Offline", 6);
+ histogram_tester.ExpectTotalCount("Previews.EligibilityReason.Offline", 7);
variations::testing::ClearAllVariationParams();
}
« no previous file with comments | « components/previews/core/previews_io_data.cc ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698