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

Side by Side Diff: third_party/WebKit/Source/web/tests/WebFrameTest.cpp

Issue 2936723002: Report frequency of single page app navigations to UMA (Closed)
Patch Set: NOTREACHED Created 3 years, 5 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 #include "platform/loader/fetch/FetchParameters.h" 105 #include "platform/loader/fetch/FetchParameters.h"
106 #include "platform/loader/fetch/MemoryCache.h" 106 #include "platform/loader/fetch/MemoryCache.h"
107 #include "platform/loader/fetch/ResourceError.h" 107 #include "platform/loader/fetch/ResourceError.h"
108 #include "platform/loader/fetch/ResourceFetcher.h" 108 #include "platform/loader/fetch/ResourceFetcher.h"
109 #include "platform/loader/fetch/ResourceLoaderOptions.h" 109 #include "platform/loader/fetch/ResourceLoaderOptions.h"
110 #include "platform/scroll/Scrollbar.h" 110 #include "platform/scroll/Scrollbar.h"
111 #include "platform/scroll/ScrollbarTestSuite.h" 111 #include "platform/scroll/ScrollbarTestSuite.h"
112 #include "platform/scroll/ScrollbarTheme.h" 112 #include "platform/scroll/ScrollbarTheme.h"
113 #include "platform/scroll/ScrollbarThemeMock.h" 113 #include "platform/scroll/ScrollbarThemeMock.h"
114 #include "platform/scroll/ScrollbarThemeOverlayMock.h" 114 #include "platform/scroll/ScrollbarThemeOverlayMock.h"
115 #include "platform/testing/HistogramTester.h"
115 #include "platform/testing/RuntimeEnabledFeaturesTestHelpers.h" 116 #include "platform/testing/RuntimeEnabledFeaturesTestHelpers.h"
116 #include "platform/testing/URLTestHelpers.h" 117 #include "platform/testing/URLTestHelpers.h"
117 #include "platform/testing/UnitTestHelpers.h" 118 #include "platform/testing/UnitTestHelpers.h"
118 #include "platform/weborigin/KURLHash.h" 119 #include "platform/weborigin/KURLHash.h"
119 #include "platform/weborigin/SchemeRegistry.h" 120 #include "platform/weborigin/SchemeRegistry.h"
120 #include "platform/weborigin/SecurityOrigin.h" 121 #include "platform/weborigin/SecurityOrigin.h"
121 #include "platform/wtf/Forward.h" 122 #include "platform/wtf/Forward.h"
122 #include "platform/wtf/PtrUtil.h" 123 #include "platform/wtf/PtrUtil.h"
123 #include "platform/wtf/dtoa/utils.h" 124 #include "platform/wtf/dtoa/utils.h"
124 #include "public/platform/Platform.h" 125 #include "public/platform/Platform.h"
(...skipping 11893 matching lines...) Expand 10 before | Expand all | Expand 10 after
12018 v8::Local<v8::Value> result = 12019 v8::Local<v8::Value> result =
12019 web_view_helper.LocalMainFrame()->ExecuteScriptAndReturnValue( 12020 web_view_helper.LocalMainFrame()->ExecuteScriptAndReturnValue(
12020 WebScriptSource("navigator.plugins.length")); 12021 WebScriptSource("navigator.plugins.length"));
12021 EXPECT_NE(0, result->Int32Value()); 12022 EXPECT_NE(0, result->Int32Value());
12022 web_view_helper.WebView()->GetPage()->GetSettings().SetPluginsEnabled(false); 12023 web_view_helper.WebView()->GetPage()->GetSettings().SetPluginsEnabled(false);
12023 result = web_view_helper.LocalMainFrame()->ExecuteScriptAndReturnValue( 12024 result = web_view_helper.LocalMainFrame()->ExecuteScriptAndReturnValue(
12024 WebScriptSource("navigator.plugins.length")); 12025 WebScriptSource("navigator.plugins.length"));
12025 EXPECT_EQ(0, result->Int32Value()); 12026 EXPECT_EQ(0, result->Int32Value());
12026 } 12027 }
12027 12028
12029 TEST_F(WebFrameTest, RecordSameDocumentNavigationToHistogram) {
12030 const char* histogramName =
12031 "RendererScheduler.UpdateForSameDocumentNavigationCount";
12032 FrameTestHelpers::WebViewHelper web_view_helper;
12033 HistogramTester tester;
12034 web_view_helper.InitializeAndLoad("about:blank");
12035 LocalFrame* frame =
12036 ToLocalFrame(web_view_helper.WebView()->GetPage()->MainFrame());
12037
12038 FrameLoader& main_frame_loader =
12039 web_view_helper.WebView()->MainFrameImpl()->GetFrame()->Loader();
12040 RefPtr<SerializedScriptValue> message =
12041 SerializeString("message", ToScriptStateForMainWorld(frame));
12042 tester.ExpectTotalCount(histogramName, 0);
12043 main_frame_loader.UpdateForSameDocumentNavigation(
12044 ToKURL("about:blank"), kSameDocumentNavigationHistoryApi, message,
12045 kScrollRestorationAuto, kFrameLoadTypeInitialHistoryLoad,
12046 frame->GetDocument());
12047 // The bucket index corresponds to the definition of
12048 // |SinglePageAppNavigationType|.
12049 tester.ExpectBucketCount(histogramName,
12050 kSPANavTypeHistoryPushStateOrReplaceState, 1);
12051 main_frame_loader.UpdateForSameDocumentNavigation(
12052 ToKURL("about:blank"), kSameDocumentNavigationDefault, message,
12053 kScrollRestorationManual, kFrameLoadTypeBackForward,
12054 frame->GetDocument());
12055 tester.ExpectBucketCount(histogramName,
12056 kSPANavTypeSameDocumentBackwardOrForward, 1);
12057 main_frame_loader.UpdateForSameDocumentNavigation(
12058 ToKURL("about:blank"), kSameDocumentNavigationDefault, message,
12059 kScrollRestorationManual, kFrameLoadTypeInitialHistoryLoad,
12060 frame->GetDocument());
12061 tester.ExpectBucketCount(histogramName, kSPANavTypeOtherFragmentNavigation,
12062 1);
12063 // kSameDocumentNavigationHistoryApi and kFrameLoadTypeBackForward is an
12064 // illegal combination, which has been caught by DCHECK in
12065 // UpdateForSameDocumentNavigation().
12066
12067 tester.ExpectTotalCount(histogramName, 3);
12068 }
12069
12028 } // namespace blink 12070 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/loader/FrameLoaderTypes.h ('k') | tools/metrics/histograms/enums.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698