| Index: third_party/WebKit/Source/web/tests/WebFrameTest.cpp
|
| diff --git a/third_party/WebKit/Source/web/tests/WebFrameTest.cpp b/third_party/WebKit/Source/web/tests/WebFrameTest.cpp
|
| index 075bd61acf7c77cbfc5366e835515ee98c49d3f4..af8c1e856e3b267ea352ee99f2467ba62859eb81 100644
|
| --- a/third_party/WebKit/Source/web/tests/WebFrameTest.cpp
|
| +++ b/third_party/WebKit/Source/web/tests/WebFrameTest.cpp
|
| @@ -103,6 +103,7 @@
|
| #include "platform/scroll/ScrollbarTheme.h"
|
| #include "platform/scroll/ScrollbarThemeMock.h"
|
| #include "platform/scroll/ScrollbarThemeOverlayMock.h"
|
| +#include "platform/testing/HistogramTester.h"
|
| #include "platform/testing/RuntimeEnabledFeaturesTestHelpers.h"
|
| #include "platform/testing/URLTestHelpers.h"
|
| #include "platform/testing/UnitTestHelpers.h"
|
| @@ -12188,4 +12189,36 @@ TEST_F(WebFrameTest, AltTextOnAboutBlankPage) {
|
| EXPECT_EQ("foo alt", text.Utf8());
|
| }
|
|
|
| +TEST_F(WebFrameTest, RecordSameDocumentNavigationToHistogram) {
|
| + const char* histogramName =
|
| + "RendererScheduler.UpdateForSameDocumentNavigationCount";
|
| + FrameTestHelpers::WebViewHelper web_view_helper;
|
| + HistogramTester tester;
|
| + web_view_helper.InitializeAndLoad("about:blank");
|
| + LocalFrame* frame =
|
| + ToLocalFrame(web_view_helper.WebView()->GetPage()->MainFrame());
|
| +
|
| + FrameLoader& main_frame_loader =
|
| + web_view_helper.WebView()->MainFrameImpl()->GetFrame()->Loader();
|
| + RefPtr<SerializedScriptValue> message =
|
| + SerializeString("message", ToScriptStateForMainWorld(frame));
|
| + tester.ExpectTotalCount(histogramName, 0);
|
| + main_frame_loader.UpdateForSameDocumentNavigation(
|
| + ToKURL("about:blank"), kSameDocumentNavigationHistoryApi, message,
|
| + kScrollRestorationAuto, kFrameLoadTypeInitialHistoryLoad,
|
| + frame->GetDocument());
|
| + tester.ExpectBucketCount(histogramName, 0, 1);
|
| + main_frame_loader.UpdateForSameDocumentNavigation(
|
| + ToKURL("about:blank"), kSameDocumentNavigationDefault, message,
|
| + kScrollRestorationManual, kFrameLoadTypeBackForward,
|
| + frame->GetDocument());
|
| + tester.ExpectBucketCount(histogramName, 1, 1);
|
| + main_frame_loader.UpdateForSameDocumentNavigation(
|
| + ToKURL("about:blank"), kSameDocumentNavigationDefault, message,
|
| + kScrollRestorationManual, kFrameLoadTypeInitialHistoryLoad,
|
| + frame->GetDocument());
|
| + tester.ExpectTotalCount(histogramName, 3);
|
| + tester.ExpectBucketCount(histogramName, 2, 1);
|
| +}
|
| +
|
| } // namespace blink
|
|
|