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

Unified Diff: components/offline_pages/snapshot_controller_unittest.cc

Issue 2030793002: Remove overeager DCHECK in SnapshotController. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: added test Created 4 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
« no previous file with comments | « components/offline_pages/snapshot_controller.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/offline_pages/snapshot_controller_unittest.cc
diff --git a/components/offline_pages/snapshot_controller_unittest.cc b/components/offline_pages/snapshot_controller_unittest.cc
index 1d49f4a6f3431a02adf6e4e591d8b018f7ad607d..08ddbdd87d801632a24eb1d70a1479ca043ea776 100644
--- a/components/offline_pages/snapshot_controller_unittest.cc
+++ b/components/offline_pages/snapshot_controller_unittest.cc
@@ -161,4 +161,20 @@ TEST_F(SnapshotControllerTest, ClientReset) {
EXPECT_EQ(2, snapshot_count());
}
+// This simulated a Reset while there is ongoing snapshot, which is reported
+// as done later. That reporting should have no effect nor crash.
+TEST_F(SnapshotControllerTest, ClientResetWhileSnapshotting) {
+ controller()->DocumentOnLoadCompletedInMainFrame();
+ EXPECT_EQ(1, snapshot_count());
+ // This normally happens when navigation starts.
+ controller()->Reset();
+ controller()->PendingSnapshotCompleted();
+ // Next snapshot should be initiated when new document is loaded.
+ controller()->DocumentAvailableInMainFrame();
+ FastForwardBy(base::TimeDelta::FromMilliseconds(
+ controller()->GetDelayAfterDocumentAvailableForTest()));
+ // No snapshot since session was reset.
+ EXPECT_EQ(2, snapshot_count());
+}
+
} // namespace offline_pages
« no previous file with comments | « components/offline_pages/snapshot_controller.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698