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

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

Issue 2174263002: Defer loads in new pages/frames if ScopedPageLoadDeferral is active (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Make the unfortunate hack slightly less ugly. Created 4 years, 4 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
« no previous file with comments | « third_party/WebKit/Source/core/page/ScopedPageLoadDeferrer.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2011, 2012 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 #include "core/frame/Settings.h" 43 #include "core/frame/Settings.h"
44 #include "core/frame/VisualViewport.h" 44 #include "core/frame/VisualViewport.h"
45 #include "core/html/HTMLDocument.h" 45 #include "core/html/HTMLDocument.h"
46 #include "core/html/HTMLIFrameElement.h" 46 #include "core/html/HTMLIFrameElement.h"
47 #include "core/html/HTMLInputElement.h" 47 #include "core/html/HTMLInputElement.h"
48 #include "core/html/HTMLTextAreaElement.h" 48 #include "core/html/HTMLTextAreaElement.h"
49 #include "core/layout/LayoutView.h" 49 #include "core/layout/LayoutView.h"
50 #include "core/loader/DocumentLoader.h" 50 #include "core/loader/DocumentLoader.h"
51 #include "core/loader/FrameLoadRequest.h" 51 #include "core/loader/FrameLoadRequest.h"
52 #include "core/page/Page.h" 52 #include "core/page/Page.h"
53 #include "core/page/ScopedPageLoadDeferrer.h"
53 #include "core/paint/PaintLayer.h" 54 #include "core/paint/PaintLayer.h"
54 #include "core/paint/PaintLayerPainter.h" 55 #include "core/paint/PaintLayerPainter.h"
55 #include "core/timing/DOMWindowPerformance.h" 56 #include "core/timing/DOMWindowPerformance.h"
56 #include "core/timing/Performance.h" 57 #include "core/timing/Performance.h"
57 #include "core/timing/PerformanceCompositeTiming.h" 58 #include "core/timing/PerformanceCompositeTiming.h"
58 #include "platform/KeyboardCodes.h" 59 #include "platform/KeyboardCodes.h"
59 #include "platform/UserGestureIndicator.h" 60 #include "platform/UserGestureIndicator.h"
60 #include "platform/geometry/IntSize.h" 61 #include "platform/geometry/IntSize.h"
61 #include "platform/graphics/Color.h" 62 #include "platform/graphics/Color.h"
62 #include "platform/graphics/GraphicsContext.h" 63 #include "platform/graphics/GraphicsContext.h"
(...skipping 3146 matching lines...) Expand 10 before | Expand all | Expand 10 after
3209 WebLocalFrameImpl* frame = webView->mainFrameImpl(); 3210 WebLocalFrameImpl* frame = webView->mainFrameImpl();
3210 frame->setAutofillClient(&client); 3211 frame->setAutofillClient(&client);
3211 webView->setInitialFocus(false); 3212 webView->setInitialFocus(false);
3212 3213
3213 EXPECT_TRUE(webView->confirmComposition(WebString::fromUTF8(std::string("hel lo").c_str()))); 3214 EXPECT_TRUE(webView->confirmComposition(WebString::fromUTF8(std::string("hel lo").c_str())));
3214 EXPECT_EQ(1, client.textChangesFromUserGesture()); 3215 EXPECT_EQ(1, client.textChangesFromUserGesture());
3215 EXPECT_FALSE(UserGestureIndicator::processingUserGesture()); 3216 EXPECT_FALSE(UserGestureIndicator::processingUserGesture());
3216 frame->setAutofillClient(0); 3217 frame->setAutofillClient(0);
3217 } 3218 }
3218 3219
3220 // Verify that a WebView created with a ScopedPageLoadDeferrer already on the
3221 // stack defers its loads.
3222 TEST_F(WebViewTest, CreatedDuringLoadDeferral)
3223 {
3224 {
3225 WebViewImpl* webView = m_webViewHelper.initialize();
3226 EXPECT_FALSE(webView->page()->defersLoading());
3227 }
3228
3229 {
3230 ScopedPageLoadDeferrer deferrer;
3231 WebViewImpl* webView = m_webViewHelper.initialize();
3232 EXPECT_TRUE(webView->page()->defersLoading());
3233 }
3234 }
3235
3236 // Verify that page loads are deferred until all ScopedPageLoadDeferrers are
3237 // destroyed.
3238 TEST_F(WebViewTest, NestedLoadDeferrals)
3239 {
3240 WebViewImpl* webView = m_webViewHelper.initialize();
3241 EXPECT_FALSE(webView->page()->defersLoading());
3242
3243 {
3244 ScopedPageLoadDeferrer deferrer;
3245 EXPECT_TRUE(webView->page()->defersLoading());
3246
3247 {
3248 ScopedPageLoadDeferrer deferrer2;
3249 EXPECT_TRUE(webView->page()->defersLoading());
3250 }
3251
3252 EXPECT_TRUE(webView->page()->defersLoading());
3253 }
3254
3255 EXPECT_FALSE(webView->page()->defersLoading());
3256 }
3257
3219 } // namespace blink 3258 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/page/ScopedPageLoadDeferrer.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698