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

Side by Side 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, 6 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 unified diff | Download patch
« no previous file with comments | « components/offline_pages/snapshot_controller.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/offline_pages/snapshot_controller.h" 5 #include "components/offline_pages/snapshot_controller.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "base/single_thread_task_runner.h" 9 #include "base/single_thread_task_runner.h"
10 #include "base/test/test_mock_time_task_runner.h" 10 #include "base/test/test_mock_time_task_runner.h"
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 EXPECT_EQ(1, snapshot_count()); 154 EXPECT_EQ(1, snapshot_count());
155 155
156 controller()->Reset(); 156 controller()->Reset();
157 controller()->DocumentAvailableInMainFrame(); 157 controller()->DocumentAvailableInMainFrame();
158 FastForwardBy(base::TimeDelta::FromMilliseconds( 158 FastForwardBy(base::TimeDelta::FromMilliseconds(
159 controller()->GetDelayAfterDocumentAvailableForTest())); 159 controller()->GetDelayAfterDocumentAvailableForTest()));
160 // No snapshot since session was reset. 160 // No snapshot since session was reset.
161 EXPECT_EQ(2, snapshot_count()); 161 EXPECT_EQ(2, snapshot_count());
162 } 162 }
163 163
164 // This simulated a Reset while there is ongoing snapshot, which is reported
165 // as done later. That reporting should have no effect nor crash.
166 TEST_F(SnapshotControllerTest, ClientResetWhileSnapshotting) {
167 controller()->DocumentOnLoadCompletedInMainFrame();
168 EXPECT_EQ(1, snapshot_count());
169 // This normally happens when navigation starts.
170 controller()->Reset();
171 controller()->PendingSnapshotCompleted();
172 // Next snapshot should be initiated when new document is loaded.
173 controller()->DocumentAvailableInMainFrame();
174 FastForwardBy(base::TimeDelta::FromMilliseconds(
175 controller()->GetDelayAfterDocumentAvailableForTest()));
176 // No snapshot since session was reset.
177 EXPECT_EQ(2, snapshot_count());
178 }
179
164 } // namespace offline_pages 180 } // namespace offline_pages
OLDNEW
« 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