OLD | NEW |
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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 #include "platform/loader/fetch/FetchParameters.h" | 96 #include "platform/loader/fetch/FetchParameters.h" |
97 #include "platform/loader/fetch/MemoryCache.h" | 97 #include "platform/loader/fetch/MemoryCache.h" |
98 #include "platform/loader/fetch/ResourceError.h" | 98 #include "platform/loader/fetch/ResourceError.h" |
99 #include "platform/loader/fetch/ResourceFetcher.h" | 99 #include "platform/loader/fetch/ResourceFetcher.h" |
100 #include "platform/loader/fetch/ResourceLoaderOptions.h" | 100 #include "platform/loader/fetch/ResourceLoaderOptions.h" |
101 #include "platform/scroll/Scrollbar.h" | 101 #include "platform/scroll/Scrollbar.h" |
102 #include "platform/scroll/ScrollbarTestSuite.h" | 102 #include "platform/scroll/ScrollbarTestSuite.h" |
103 #include "platform/scroll/ScrollbarTheme.h" | 103 #include "platform/scroll/ScrollbarTheme.h" |
104 #include "platform/scroll/ScrollbarThemeMock.h" | 104 #include "platform/scroll/ScrollbarThemeMock.h" |
105 #include "platform/scroll/ScrollbarThemeOverlayMock.h" | 105 #include "platform/scroll/ScrollbarThemeOverlayMock.h" |
| 106 #include "platform/testing/HistogramTester.h" |
106 #include "platform/testing/RuntimeEnabledFeaturesTestHelpers.h" | 107 #include "platform/testing/RuntimeEnabledFeaturesTestHelpers.h" |
107 #include "platform/testing/URLTestHelpers.h" | 108 #include "platform/testing/URLTestHelpers.h" |
108 #include "platform/testing/UnitTestHelpers.h" | 109 #include "platform/testing/UnitTestHelpers.h" |
109 #include "platform/weborigin/KURLHash.h" | 110 #include "platform/weborigin/KURLHash.h" |
110 #include "platform/weborigin/SchemeRegistry.h" | 111 #include "platform/weborigin/SchemeRegistry.h" |
111 #include "platform/weborigin/SecurityOrigin.h" | 112 #include "platform/weborigin/SecurityOrigin.h" |
112 #include "platform/wtf/Forward.h" | 113 #include "platform/wtf/Forward.h" |
113 #include "platform/wtf/PtrUtil.h" | 114 #include "platform/wtf/PtrUtil.h" |
114 #include "platform/wtf/dtoa/utils.h" | 115 #include "platform/wtf/dtoa/utils.h" |
115 #include "public/platform/Platform.h" | 116 #include "public/platform/Platform.h" |
(...skipping 12065 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12181 for (LayoutObject* obj = layout_object; obj; obj = obj->NextInPreOrder()) { | 12182 for (LayoutObject* obj = layout_object; obj; obj = obj->NextInPreOrder()) { |
12182 if (obj->IsText()) { | 12183 if (obj->IsText()) { |
12183 LayoutText* layout_text = ToLayoutText(obj); | 12184 LayoutText* layout_text = ToLayoutText(obj); |
12184 text = layout_text->GetText(); | 12185 text = layout_text->GetText(); |
12185 break; | 12186 break; |
12186 } | 12187 } |
12187 } | 12188 } |
12188 EXPECT_EQ("foo alt", text.Utf8()); | 12189 EXPECT_EQ("foo alt", text.Utf8()); |
12189 } | 12190 } |
12190 | 12191 |
| 12192 TEST_F(WebFrameTest, RecordSameDocumentNavigationToHistogram) { |
| 12193 const char* histogramName = |
| 12194 "RendererScheduler.UpdateForSameDocumentNavigationCount"; |
| 12195 FrameTestHelpers::WebViewHelper web_view_helper; |
| 12196 HistogramTester tester; |
| 12197 web_view_helper.InitializeAndLoad("about:blank"); |
| 12198 LocalFrame* frame = |
| 12199 ToLocalFrame(web_view_helper.WebView()->GetPage()->MainFrame()); |
| 12200 |
| 12201 FrameLoader& main_frame_loader = |
| 12202 web_view_helper.WebView()->MainFrameImpl()->GetFrame()->Loader(); |
| 12203 RefPtr<SerializedScriptValue> message = |
| 12204 SerializeString("message", ToScriptStateForMainWorld(frame)); |
| 12205 tester.ExpectTotalCount(histogramName, 0); |
| 12206 main_frame_loader.UpdateForSameDocumentNavigation( |
| 12207 ToKURL("about:blank"), kSameDocumentNavigationHistoryApi, message, |
| 12208 kScrollRestorationAuto, kFrameLoadTypeInitialHistoryLoad, |
| 12209 frame->GetDocument()); |
| 12210 // The bucket index corresponds to the definition of |
| 12211 // |SinglePageAppNavigationType|. |
| 12212 tester.ExpectBucketCount(histogramName, |
| 12213 kSPANavTypeHistoryPushStateOrReplaceState, 1); |
| 12214 main_frame_loader.UpdateForSameDocumentNavigation( |
| 12215 ToKURL("about:blank"), kSameDocumentNavigationDefault, message, |
| 12216 kScrollRestorationManual, kFrameLoadTypeBackForward, |
| 12217 frame->GetDocument()); |
| 12218 tester.ExpectBucketCount(histogramName, |
| 12219 kSPANavTypeSameDocumentBackwardOrForward, 1); |
| 12220 main_frame_loader.UpdateForSameDocumentNavigation( |
| 12221 ToKURL("about:blank"), kSameDocumentNavigationDefault, message, |
| 12222 kScrollRestorationManual, kFrameLoadTypeInitialHistoryLoad, |
| 12223 frame->GetDocument()); |
| 12224 tester.ExpectBucketCount(histogramName, kSPANavTypeOtherFragmentNavigation, |
| 12225 1); |
| 12226 // kSameDocumentNavigationHistoryApi and kFrameLoadTypeBackForward is an |
| 12227 // illegal combination, which has been caught by DCHECK in |
| 12228 // UpdateForSameDocumentNavigation(). |
| 12229 |
| 12230 tester.ExpectTotalCount(histogramName, 3); |
| 12231 } |
| 12232 |
12191 } // namespace blink | 12233 } // namespace blink |
OLD | NEW |