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

Unified Diff: components/offline_pages/core/snapshot_controller_unittest.cc

Issue 2797013002: [Offline pages] Update background loader to override the WebContentsObserver methods expected (Closed)
Patch Set: Created 3 years, 8 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/offline_pages/core/snapshot_controller_unittest.cc
diff --git a/components/offline_pages/core/snapshot_controller_unittest.cc b/components/offline_pages/core/snapshot_controller_unittest.cc
index a57c2da897b3c344a592a24c0c0f6b2b32515ed7..30ecaa946291005c95ee66d1de359478d6de4250 100644
--- a/components/offline_pages/core/snapshot_controller_unittest.cc
+++ b/components/offline_pages/core/snapshot_controller_unittest.cc
@@ -79,25 +79,25 @@ TEST_F(SnapshotControllerTest, OnLoad) {
PumpLoop();
EXPECT_EQ(0, snapshot_count());
FastForwardBy(base::TimeDelta::FromMilliseconds(
- controller()->GetDelayAfterDocumentOnLoadCompletedForTest()));
+ controller()->GetDelayAfterLoadCompletedForTest()));
EXPECT_EQ(1, snapshot_count());
}
TEST_F(SnapshotControllerTest, OnDocumentAvailable) {
- EXPECT_GT(controller()->GetDelayAfterDocumentAvailableForTest(), 0LL);
+ EXPECT_GT(controller()->GetDelayAfterDocumentLoadedForTest(), 0LL);
// OnDOM should make snapshot after a delay.
controller()->DocumentAvailableInMainFrame();
PumpLoop();
EXPECT_EQ(0, snapshot_count());
FastForwardBy(base::TimeDelta::FromMilliseconds(
- controller()->GetDelayAfterDocumentAvailableForTest()));
+ controller()->GetDelayAfterDocumentLoadedForTest()));
EXPECT_EQ(1, snapshot_count());
}
TEST_F(SnapshotControllerTest, OnLoadSnapshotIsTheLastOne) {
// This test assumes DocumentAvailable delay is longer than OnLoadCompleted.
- EXPECT_GT(controller()->GetDelayAfterDocumentAvailableForTest(),
- controller()->GetDelayAfterDocumentOnLoadCompletedForTest());
+ EXPECT_GT(controller()->GetDelayAfterDocumentLoadedForTest(),
+ controller()->GetDelayAfterLoadCompletedForTest());
// OnDOM should make snapshot after a delay.
controller()->DocumentAvailableInMainFrame();
PumpLoop();
@@ -105,14 +105,14 @@ TEST_F(SnapshotControllerTest, OnLoadSnapshotIsTheLastOne) {
controller()->DocumentOnLoadCompletedInMainFrame();
// Advance time to OnLoadCompleted delay to trigger snapshot.
FastForwardBy(base::TimeDelta::FromMilliseconds(
- controller()->GetDelayAfterDocumentOnLoadCompletedForTest()));
+ controller()->GetDelayAfterLoadCompletedForTest()));
EXPECT_EQ(1, snapshot_count());
// Report that snapshot is completed.
controller()->PendingSnapshotCompleted();
// Even though previous snapshot is completed, new one should not start
// when this DocumentAvailable delay expires.
FastForwardBy(base::TimeDelta::FromMilliseconds(
- controller()->GetDelayAfterDocumentAvailableForTest()));
+ controller()->GetDelayAfterDocumentLoadedForTest()));
EXPECT_EQ(1, snapshot_count());
}
@@ -122,14 +122,14 @@ TEST_F(SnapshotControllerTest, OnLoadSnapshotAfterLongDelay) {
PumpLoop();
EXPECT_EQ(0, snapshot_count());
FastForwardBy(base::TimeDelta::FromMilliseconds(
- controller()->GetDelayAfterDocumentAvailableForTest()));
+ controller()->GetDelayAfterDocumentLoadedForTest()));
EXPECT_EQ(1, snapshot_count());
// Report that snapshot is completed.
controller()->PendingSnapshotCompleted();
// OnLoad should make 2nd snapshot after its delay.
controller()->DocumentOnLoadCompletedInMainFrame();
FastForwardBy(base::TimeDelta::FromMilliseconds(
- controller()->GetDelayAfterDocumentOnLoadCompletedForTest()));
+ controller()->GetDelayAfterLoadCompletedForTest()));
EXPECT_EQ(2, snapshot_count());
}
@@ -140,7 +140,7 @@ TEST_F(SnapshotControllerTest, Stop) {
EXPECT_EQ(0, snapshot_count());
controller()->Stop();
FastForwardBy(base::TimeDelta::FromMilliseconds(
- controller()->GetDelayAfterDocumentAvailableForTest()));
+ controller()->GetDelayAfterDocumentLoadedForTest()));
// Should not start snapshots
EXPECT_EQ(0, snapshot_count());
// Also should not start snapshot.
@@ -153,18 +153,18 @@ TEST_F(SnapshotControllerTest, ClientReset) {
controller()->Reset();
FastForwardBy(base::TimeDelta::FromMilliseconds(
- controller()->GetDelayAfterDocumentAvailableForTest()));
+ controller()->GetDelayAfterDocumentLoadedForTest()));
// No snapshot since session was reset.
EXPECT_EQ(0, snapshot_count());
controller()->DocumentOnLoadCompletedInMainFrame();
FastForwardBy(base::TimeDelta::FromMilliseconds(
- controller()->GetDelayAfterDocumentOnLoadCompletedForTest()));
+ controller()->GetDelayAfterLoadCompletedForTest()));
EXPECT_EQ(1, snapshot_count());
controller()->Reset();
controller()->DocumentAvailableInMainFrame();
FastForwardBy(base::TimeDelta::FromMilliseconds(
- controller()->GetDelayAfterDocumentAvailableForTest()));
+ controller()->GetDelayAfterDocumentLoadedForTest()));
// No snapshot since session was reset.
EXPECT_EQ(2, snapshot_count());
}
@@ -174,7 +174,7 @@ TEST_F(SnapshotControllerTest, ClientReset) {
TEST_F(SnapshotControllerTest, ClientResetWhileSnapshotting) {
controller()->DocumentOnLoadCompletedInMainFrame();
FastForwardBy(base::TimeDelta::FromMilliseconds(
- controller()->GetDelayAfterDocumentOnLoadCompletedForTest()));
+ controller()->GetDelayAfterLoadCompletedForTest()));
EXPECT_EQ(1, snapshot_count());
// This normally happens when navigation starts.
controller()->Reset();
@@ -182,7 +182,7 @@ TEST_F(SnapshotControllerTest, ClientResetWhileSnapshotting) {
// Next snapshot should be initiated when new document is loaded.
controller()->DocumentAvailableInMainFrame();
FastForwardBy(base::TimeDelta::FromMilliseconds(
- controller()->GetDelayAfterDocumentAvailableForTest()));
+ controller()->GetDelayAfterDocumentLoadedForTest()));
// No snapshot since session was reset.
EXPECT_EQ(2, snapshot_count());
}

Powered by Google App Engine
This is Rietveld 408576698