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

Unified Diff: chrome/browser/android/offline_pages/background_loader_offliner_unittest.cc

Issue 2751253004: [Offline Pages] Add UMA to record final offline request status and loading failed error code. (Closed)
Patch Set: fix unit test so DidFinishNavigation is only called once Created 3 years, 9 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: chrome/browser/android/offline_pages/background_loader_offliner_unittest.cc
diff --git a/chrome/browser/android/offline_pages/background_loader_offliner_unittest.cc b/chrome/browser/android/offline_pages/background_loader_offliner_unittest.cc
index 88aee2ce05e9ea2c1309479182fd4e93f050192b..efe87a842c48a67e866ba2289069df584dc0b83c 100644
--- a/chrome/browser/android/offline_pages/background_loader_offliner_unittest.cc
+++ b/chrome/browser/android/offline_pages/background_loader_offliner_unittest.cc
@@ -33,7 +33,7 @@ namespace {
const int64_t kRequestId = 7;
const GURL kHttpUrl("http://www.tunafish.com");
const GURL kFileUrl("file://salmon.png");
-const ClientId kClientId("AsyncLoading", "88");
+const ClientId kClientId("async_loading", "88");
const bool kUserRequested = true;
// Mock OfflinePageModel for testing the SavePage calls
@@ -421,17 +421,18 @@ TEST_F(BackgroundLoaderOfflinerTest, FailsOnErrorPage) {
kUserRequested);
EXPECT_TRUE(offliner()->LoadAndSave(request, completion_callback(),
progress_callback()));
-
// Create handle with net error code.
// Called after calling LoadAndSave so we have web_contents to work with.
std::unique_ptr<content::NavigationHandle> handle(
content::NavigationHandle::CreateNavigationHandleForTesting(
kHttpUrl, offliner()->web_contents()->GetMainFrame(), true,
net::Error::ERR_NAME_NOT_RESOLVED));
- // Call DidFinishNavigation with handle that contains error.
- offliner()->DidFinishNavigation(handle.get());
- // NavigationHandle is always destroyed after finishing navigation.
+ // NavigationHandle destruction will trigger DidFinishNavigation code.
handle.reset();
+ histograms().ExpectBucketCount(
+ "OfflinePages.Background.BackgroundLoadingFailedCode.async_loading",
+ 105, // ERR_NAME_NOT_RESOLVED
+ 1);
offliner()->DidStopLoading();
PumpLoop();

Powered by Google App Engine
This is Rietveld 408576698