diff options
| author | Simon Hausmann <simon.hausmann@digia.com> | 2012-09-26 10:42:44 +0200 |
|---|---|---|
| committer | Simon Hausmann <simon.hausmann@digia.com> | 2012-09-26 10:42:44 +0200 |
| commit | 33b26980cb24288b5a9f2590ccf32a949281bb79 (patch) | |
| tree | cc0203dac37338b24b0b25a4694c0b76d4e4164b /Tools/TestWebKitAPI | |
| parent | 715be629d51174233403237bfc563cf150087dc8 (diff) | |
| download | qtwebkit-33b26980cb24288b5a9f2590ccf32a949281bb79.tar.gz | |
Imported WebKit commit c596dd7f03007fa7ed896b928106497e8784b3b5 (http://svn.webkit.org/repository/webkit/trunk@129610)
New snapshot that removes QtQuick1 support (to be moved into QtQuick1 module)
Diffstat (limited to 'Tools/TestWebKitAPI')
9 files changed, 81 insertions, 39 deletions
diff --git a/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj b/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj index 492589158..e144f5f37 100644 --- a/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj +++ b/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj @@ -72,6 +72,7 @@ 76E182DF154767E600F1FADD /* auto-submitting-form.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 76E182DE15475A8300F1FADD /* auto-submitting-form.html */; }; 81B50193140F232300D9EB58 /* StringBuilder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 81B50192140F232300D9EB58 /* StringBuilder.cpp */; }; 930AD402150698D00067970F /* lots-of-text.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 930AD401150698B30067970F /* lots-of-text.html */; }; + 9318778915EEC57700A9CCE3 /* NewFirstVisuallyNonEmptyLayoutForImages.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93AF4ECA1506F035007FD57E /* NewFirstVisuallyNonEmptyLayoutForImages.cpp */; }; 9361002914DC95A70061379D /* lots-of-iframes.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 9361002814DC957B0061379D /* lots-of-iframes.html */; }; 939BA91714103412001A01BD /* DeviceScaleFactorOnBack.mm in Sources */ = {isa = PBXBuildFile; fileRef = 939BA91614103412001A01BD /* DeviceScaleFactorOnBack.mm */; }; 93AF4ECE1506F064007FD57E /* NewFirstVisuallyNonEmptyLayoutForImages_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93AF4ECD1506F064007FD57E /* NewFirstVisuallyNonEmptyLayoutForImages_Bundle.cpp */; }; @@ -985,6 +986,7 @@ BC90995E12567BC100083756 /* WKString.cpp in Sources */, BC9099941256ACF100083756 /* WKStringJSString.cpp in Sources */, 265AF55015D1E48A00B0CB4A /* WTFString.cpp in Sources */, + 9318778915EEC57700A9CCE3 /* NewFirstVisuallyNonEmptyLayoutForImages.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/Tools/TestWebKitAPI/Tests/WebKit2/NewFirstVisuallyNonEmptyLayout.cpp b/Tools/TestWebKitAPI/Tests/WebKit2/NewFirstVisuallyNonEmptyLayout.cpp index f90f3eb2b..605003ed6 100644 --- a/Tools/TestWebKitAPI/Tests/WebKit2/NewFirstVisuallyNonEmptyLayout.cpp +++ b/Tools/TestWebKitAPI/Tests/WebKit2/NewFirstVisuallyNonEmptyLayout.cpp @@ -30,11 +30,29 @@ namespace TestWebKitAPI { -static bool didNewFirstVisuallyNonEmptyLayoutSucceed; +static bool didFirstLayoutAchieved; +static bool didFirstVisuallyNonEmptyLayoutAchieved; +static bool didHitRelevantRepaintedObjectsAreaThresholdAchieved; +static bool didUnlockAllLayoutMilestones; -static void didNewFirstVisuallyNonEmptyLayout(WKPageRef, WKTypeRef, const void *) +static void didLayout(WKPageRef, WKLayoutMilestones type, WKTypeRef, const void *) { - didNewFirstVisuallyNonEmptyLayoutSucceed = true; + switch (type) { + case kWKDidFirstLayout: + didFirstLayoutAchieved = true; + break; + case kWKDidFirstVisuallyNonEmptyLayout: + didFirstVisuallyNonEmptyLayoutAchieved = true; + break; + case kWKDidHitRelevantRepaintedObjectsAreaThreshold: + didHitRelevantRepaintedObjectsAreaThresholdAchieved = true; + break; + default: + break; + } + + if (didFirstLayoutAchieved && didFirstVisuallyNonEmptyLayoutAchieved && didHitRelevantRepaintedObjectsAreaThresholdAchieved) + didUnlockAllLayoutMilestones = true; } static void setPageLoaderClient(WKPageRef page) @@ -42,11 +60,15 @@ static void setPageLoaderClient(WKPageRef page) WKPageLoaderClient loaderClient; memset(&loaderClient, 0, sizeof(loaderClient)); loaderClient.version = kWKPageLoaderClientCurrentVersion; - loaderClient.didNewFirstVisuallyNonEmptyLayout = didNewFirstVisuallyNonEmptyLayout; + loaderClient.didLayout = didLayout; WKPageSetPageLoaderClient(page, &loaderClient); } +// FIXME: This test has been broken since http://trac.webkit.org/changeset/115752 It's failing because +// the frame load is completing before didLayout() manages to unlock the +// kWKDidHitRelevantRepaintedObjectsAreaThreshold achievement. We probably need to fix this by making +// this test have a long-running resource. TEST(WebKit2, DISABLED_NewFirstVisuallyNonEmptyLayout) { WKRetainPtr<WKContextRef> context(AdoptWK, Util::createContextForInjectedBundleTest("NewFirstVisuallyNonEmptyLayoutTest")); @@ -58,8 +80,8 @@ TEST(WebKit2, DISABLED_NewFirstVisuallyNonEmptyLayout) // objects take up more than 10% of the view. WKPageLoadURL(webView.page(), adoptWK(Util::createURLForResource("lots-of-text", "html")).get()); - Util::run(&didNewFirstVisuallyNonEmptyLayoutSucceed); - EXPECT_TRUE(didNewFirstVisuallyNonEmptyLayoutSucceed); + Util::run(&didUnlockAllLayoutMilestones); + EXPECT_TRUE(didUnlockAllLayoutMilestones); } } // namespace TestWebKitAPI diff --git a/Tools/TestWebKitAPI/Tests/WebKit2/NewFirstVisuallyNonEmptyLayoutFails.cpp b/Tools/TestWebKitAPI/Tests/WebKit2/NewFirstVisuallyNonEmptyLayoutFails.cpp index 96eea6eba..06c71502e 100644 --- a/Tools/TestWebKitAPI/Tests/WebKit2/NewFirstVisuallyNonEmptyLayoutFails.cpp +++ b/Tools/TestWebKitAPI/Tests/WebKit2/NewFirstVisuallyNonEmptyLayoutFails.cpp @@ -32,7 +32,7 @@ namespace TestWebKitAPI { -static bool didNewFirstVisuallyNonEmptyLayoutSucceed; +static bool didHitRelevantRepaintedObjectsAreaThresholdAchieved; static bool test1Done; static bool test2Done; @@ -48,9 +48,10 @@ static void didFinishLoadForFrame(WKPageRef page, WKFrameRef frame, WKTypeRef us WKPageForceRepaint(page, 0, didForceRepaint); } -static void didNewFirstVisuallyNonEmptyLayout(WKPageRef, WKTypeRef, const void *) +static void didLayout(WKPageRef, WKLayoutMilestones type, WKTypeRef, const void *) { - didNewFirstVisuallyNonEmptyLayoutSucceed = true; + if (type == kWKDidHitRelevantRepaintedObjectsAreaThreshold) + didHitRelevantRepaintedObjectsAreaThresholdAchieved = true; } static void setPageLoaderClient(WKPageRef page) @@ -59,7 +60,7 @@ static void setPageLoaderClient(WKPageRef page) memset(&loaderClient, 0, sizeof(loaderClient)); loaderClient.version = kWKPageLoaderClientCurrentVersion; loaderClient.didFinishLoadForFrame = didFinishLoadForFrame; - loaderClient.didNewFirstVisuallyNonEmptyLayout = didNewFirstVisuallyNonEmptyLayout; + loaderClient.didLayout = didLayout; WKPageSetPageLoaderClient(page, &loaderClient); } @@ -80,7 +81,7 @@ TEST(WebKit2, NewFirstVisuallyNonEmptyLayoutFails) // By the time the forced repaint has finished, the counter would have been hit // if it was sized reasonably for the page. - EXPECT_FALSE(didNewFirstVisuallyNonEmptyLayoutSucceed); + EXPECT_FALSE(didHitRelevantRepaintedObjectsAreaThresholdAchieved); } } // namespace TestWebKitAPI diff --git a/Tools/TestWebKitAPI/Tests/WebKit2/NewFirstVisuallyNonEmptyLayoutFails_Bundle.cpp b/Tools/TestWebKitAPI/Tests/WebKit2/NewFirstVisuallyNonEmptyLayoutFails_Bundle.cpp index b05f67558..b909ec941 100644 --- a/Tools/TestWebKitAPI/Tests/WebKit2/NewFirstVisuallyNonEmptyLayoutFails_Bundle.cpp +++ b/Tools/TestWebKitAPI/Tests/WebKit2/NewFirstVisuallyNonEmptyLayoutFails_Bundle.cpp @@ -41,9 +41,7 @@ public: virtual void didCreatePage(WKBundleRef bundle, WKBundlePageRef page) { - // Setting the painted objects counter is necessary at this time to opt into - // the didNewFirstVisuallyNonEmptyLayout heuristic. - WKBundlePageSetPaintedObjectsCounterThreshold(page, 1); + WKBundlePageListenForLayoutMilestones(page, kWKDidFirstLayout | kWKDidFirstVisuallyNonEmptyLayout | kWKDidHitRelevantRepaintedObjectsAreaThreshold); } }; diff --git a/Tools/TestWebKitAPI/Tests/WebKit2/NewFirstVisuallyNonEmptyLayoutForImages.cpp b/Tools/TestWebKitAPI/Tests/WebKit2/NewFirstVisuallyNonEmptyLayoutForImages.cpp index 0a4e376ed..2ec5bd05c 100644 --- a/Tools/TestWebKitAPI/Tests/WebKit2/NewFirstVisuallyNonEmptyLayoutForImages.cpp +++ b/Tools/TestWebKitAPI/Tests/WebKit2/NewFirstVisuallyNonEmptyLayoutForImages.cpp @@ -30,11 +30,29 @@ namespace TestWebKitAPI { -static bool didNewFirstVisuallyNonEmptyLayoutSucceed; +static bool didFirstLayoutAchieved; +static bool didFirstVisuallyNonEmptyLayoutAchieved; +static bool didHitRelevantRepaintedObjectsAreaThresholdAchieved; +static bool didUnlockAllLayoutMilestones; -static void didNewFirstVisuallyNonEmptyLayout(WKPageRef, WKTypeRef, const void *) +static void didLayout(WKPageRef, WKLayoutMilestones type, WKTypeRef, const void *) { - didNewFirstVisuallyNonEmptyLayoutSucceed = true; + switch (type) { + case kWKDidFirstLayout: + didFirstLayoutAchieved = true; + break; + case kWKDidFirstVisuallyNonEmptyLayout: + didFirstVisuallyNonEmptyLayoutAchieved = true; + break; + case kWKDidHitRelevantRepaintedObjectsAreaThreshold: + didHitRelevantRepaintedObjectsAreaThresholdAchieved = true; + break; + default: + break; + } + + if (didFirstLayoutAchieved && didFirstVisuallyNonEmptyLayoutAchieved && didHitRelevantRepaintedObjectsAreaThresholdAchieved) + didUnlockAllLayoutMilestones = true; } static void setPageLoaderClient(WKPageRef page) @@ -42,12 +60,16 @@ static void setPageLoaderClient(WKPageRef page) WKPageLoaderClient loaderClient; memset(&loaderClient, 0, sizeof(loaderClient)); loaderClient.version = kWKPageLoaderClientCurrentVersion; - loaderClient.didNewFirstVisuallyNonEmptyLayout = didNewFirstVisuallyNonEmptyLayout; + loaderClient.didLayout = didLayout; WKPageSetPageLoaderClient(page, &loaderClient); } -TEST(WebKit2, NewFirstVisuallyNonEmptyLayoutForImages) +// FIXME: This test has been broken since http://trac.webkit.org/changeset/115752 It's failing because +// the frame load is completing before didLayout() manages to unlock the +// kWKDidHitRelevantRepaintedObjectsAreaThreshold achievement. We probably need to fix this by making +// this test have a long-running resource. +TEST(WebKit2, DISABLED_NewFirstVisuallyNonEmptyLayoutForImages) { WKRetainPtr<WKContextRef> context(AdoptWK, Util::createContextForInjectedBundleTest("NewFirstVisuallyNonEmptyLayoutForImagesTest")); @@ -58,8 +80,8 @@ TEST(WebKit2, NewFirstVisuallyNonEmptyLayoutForImages) // objects take up more than 10% of the view. WKPageLoadURL(webView.page(), adoptWK(Util::createURLForResource("lots-of-images", "html")).get()); - Util::run(&didNewFirstVisuallyNonEmptyLayoutSucceed); - EXPECT_TRUE(didNewFirstVisuallyNonEmptyLayoutSucceed); + Util::run(&didUnlockAllLayoutMilestones); + EXPECT_TRUE(didUnlockAllLayoutMilestones); } } // namespace TestWebKitAPI diff --git a/Tools/TestWebKitAPI/Tests/WebKit2/NewFirstVisuallyNonEmptyLayoutForImages_Bundle.cpp b/Tools/TestWebKitAPI/Tests/WebKit2/NewFirstVisuallyNonEmptyLayoutForImages_Bundle.cpp index 3a50407a2..bdaade77b 100644 --- a/Tools/TestWebKitAPI/Tests/WebKit2/NewFirstVisuallyNonEmptyLayoutForImages_Bundle.cpp +++ b/Tools/TestWebKitAPI/Tests/WebKit2/NewFirstVisuallyNonEmptyLayoutForImages_Bundle.cpp @@ -41,9 +41,7 @@ public: virtual void didCreatePage(WKBundleRef bundle, WKBundlePageRef page) { - // Setting the painted objects counter is necessary at this time to opt into - // the didNewFirstVisuallyNonEmptyLayout heuristic. - WKBundlePageSetPaintedObjectsCounterThreshold(page, 1); + WKBundlePageListenForLayoutMilestones(page, kWKDidFirstLayout | kWKDidFirstVisuallyNonEmptyLayout | kWKDidHitRelevantRepaintedObjectsAreaThreshold); } }; diff --git a/Tools/TestWebKitAPI/Tests/WebKit2/NewFirstVisuallyNonEmptyLayoutFrames.cpp b/Tools/TestWebKitAPI/Tests/WebKit2/NewFirstVisuallyNonEmptyLayoutFrames.cpp index d9f61d40b..1ad4b9986 100644 --- a/Tools/TestWebKitAPI/Tests/WebKit2/NewFirstVisuallyNonEmptyLayoutFrames.cpp +++ b/Tools/TestWebKitAPI/Tests/WebKit2/NewFirstVisuallyNonEmptyLayoutFrames.cpp @@ -32,8 +32,8 @@ namespace TestWebKitAPI { -static bool didNewFirstVisuallyNonEmptyLayoutFireMoreThanOnce; -static unsigned newVisuallyNonEmptyLayoutCounter; +static bool didHitRelevantRepaintedObjectsAreaThresholdMoreThanOnce; +static unsigned didHitRelevantRepaintedObjectsAreaThresholdCounter; static bool test1Done; static bool test2Done; @@ -49,11 +49,14 @@ static void didFinishLoadForFrame(WKPageRef page, WKFrameRef frame, WKTypeRef us WKPageForceRepaint(page, 0, didForceRepaint); } -static void didNewFirstVisuallyNonEmptyLayout(WKPageRef, WKTypeRef, const void *) +static void didLayout(WKPageRef, WKLayoutMilestones type, WKTypeRef, const void *) { - ++newVisuallyNonEmptyLayoutCounter; - if (newVisuallyNonEmptyLayoutCounter > 1) - didNewFirstVisuallyNonEmptyLayoutFireMoreThanOnce = true; + if (type != kWKDidHitRelevantRepaintedObjectsAreaThreshold) + return; + + ++didHitRelevantRepaintedObjectsAreaThresholdCounter; + if (didHitRelevantRepaintedObjectsAreaThresholdCounter > 1) + didHitRelevantRepaintedObjectsAreaThresholdMoreThanOnce = true; } static void setPageLoaderClient(WKPageRef page) @@ -62,14 +65,14 @@ static void setPageLoaderClient(WKPageRef page) memset(&loaderClient, 0, sizeof(loaderClient)); loaderClient.version = kWKPageLoaderClientCurrentVersion; loaderClient.didFinishLoadForFrame = didFinishLoadForFrame; - loaderClient.didNewFirstVisuallyNonEmptyLayout = didNewFirstVisuallyNonEmptyLayout; + loaderClient.didLayout = didLayout; WKPageSetPageLoaderClient(page, &loaderClient); } TEST(WebKit2, NewFirstVisuallyNonEmptyLayoutFrames) { - newVisuallyNonEmptyLayoutCounter = 0; + didHitRelevantRepaintedObjectsAreaThresholdCounter = 0; WKRetainPtr<WKContextRef> context(AdoptWK, Util::createContextForInjectedBundleTest("NewFirstVisuallyNonEmptyLayoutFramesTest")); PlatformWebView webView(context.get()); @@ -82,7 +85,7 @@ TEST(WebKit2, NewFirstVisuallyNonEmptyLayoutFrames) // By the time the forced repaint has finished, the counter would have been hit // if it was sized reasonably for the page. - EXPECT_FALSE(didNewFirstVisuallyNonEmptyLayoutFireMoreThanOnce); + EXPECT_FALSE(didHitRelevantRepaintedObjectsAreaThresholdMoreThanOnce); } } // namespace TestWebKitAPI diff --git a/Tools/TestWebKitAPI/Tests/WebKit2/NewFirstVisuallyNonEmptyLayoutFrames_Bundle.cpp b/Tools/TestWebKitAPI/Tests/WebKit2/NewFirstVisuallyNonEmptyLayoutFrames_Bundle.cpp index ffef9e22f..33e16bd3e 100644 --- a/Tools/TestWebKitAPI/Tests/WebKit2/NewFirstVisuallyNonEmptyLayoutFrames_Bundle.cpp +++ b/Tools/TestWebKitAPI/Tests/WebKit2/NewFirstVisuallyNonEmptyLayoutFrames_Bundle.cpp @@ -41,9 +41,7 @@ public: virtual void didCreatePage(WKBundleRef bundle, WKBundlePageRef page) { - // Setting the painted objects counter is necessary at this time to opt into - // the didNewFirstVisuallyNonEmptyLayout heuristic. - WKBundlePageSetPaintedObjectsCounterThreshold(page, 1); + WKBundlePageListenForLayoutMilestones(page, kWKDidFirstLayout | kWKDidFirstVisuallyNonEmptyLayout | kWKDidHitRelevantRepaintedObjectsAreaThreshold); } }; diff --git a/Tools/TestWebKitAPI/Tests/WebKit2/NewFirstVisuallyNonEmptyLayout_Bundle.cpp b/Tools/TestWebKitAPI/Tests/WebKit2/NewFirstVisuallyNonEmptyLayout_Bundle.cpp index 5227f06a8..c408c3b2c 100644 --- a/Tools/TestWebKitAPI/Tests/WebKit2/NewFirstVisuallyNonEmptyLayout_Bundle.cpp +++ b/Tools/TestWebKitAPI/Tests/WebKit2/NewFirstVisuallyNonEmptyLayout_Bundle.cpp @@ -41,9 +41,7 @@ public: virtual void didCreatePage(WKBundleRef bundle, WKBundlePageRef page) { - // Setting the painted objects counter is necessary at this time to opt into - // the didNewFirstVisuallyNonEmptyLayout heuristic. - WKBundlePageSetPaintedObjectsCounterThreshold(page, 1); + WKBundlePageListenForLayoutMilestones(page, kWKDidFirstLayout | kWKDidFirstVisuallyNonEmptyLayout | kWKDidHitRelevantRepaintedObjectsAreaThreshold); } }; |
