| 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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 | 169 |
| 170 class WebFrameTest : public ::testing::Test { | 170 class WebFrameTest : public ::testing::Test { |
| 171 protected: | 171 protected: |
| 172 WebFrameTest() | 172 WebFrameTest() |
| 173 : m_baseURL("http://internal.test/") | 173 : m_baseURL("http://internal.test/") |
| 174 , m_notBaseURL("http://external.test/") | 174 , m_notBaseURL("http://external.test/") |
| 175 , m_chromeURL("chrome://") | 175 , m_chromeURL("chrome://") |
| 176 { | 176 { |
| 177 } | 177 } |
| 178 | 178 |
| 179 virtual ~WebFrameTest() | 179 ~WebFrameTest() override |
| 180 { | 180 { |
| 181 Platform::current()->unitTestSupport()->unregisterAllMockedURLs(); | 181 Platform::current()->unitTestSupport()->unregisterAllMockedURLs(); |
| 182 } | 182 } |
| 183 | 183 |
| 184 void registerMockedHttpURLLoad(const std::string& fileName) | 184 void registerMockedHttpURLLoad(const std::string& fileName) |
| 185 { | 185 { |
| 186 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseU
RL.c_str()), WebString::fromUTF8(fileName.c_str())); | 186 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseU
RL.c_str()), WebString::fromUTF8(fileName.c_str())); |
| 187 } | 187 } |
| 188 | 188 |
| 189 void registerMockedChromeURLLoad(const std::string& fileName) | 189 void registerMockedChromeURLLoad(const std::string& fileName) |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 Default, | 261 Default, |
| 262 RootLayerScrolls | 262 RootLayerScrolls |
| 263 }; | 263 }; |
| 264 | 264 |
| 265 class ParameterizedWebFrameTest | 265 class ParameterizedWebFrameTest |
| 266 : public WebFrameTest | 266 : public WebFrameTest |
| 267 , public ::testing::WithParamInterface<ParameterizedWebFrameTestConfig> | 267 , public ::testing::WithParamInterface<ParameterizedWebFrameTestConfig> |
| 268 , public FrameTestHelpers::SettingOverrider { | 268 , public FrameTestHelpers::SettingOverrider { |
| 269 public: | 269 public: |
| 270 | 270 |
| 271 virtual void overrideSettings(WebSettings* settings) | 271 void overrideSettings(WebSettings* settings) |
| 272 { | 272 { |
| 273 switch (GetParam()) { | 273 switch (GetParam()) { |
| 274 case Default: | 274 case Default: |
| 275 break; | 275 break; |
| 276 case RootLayerScrolls: | 276 case RootLayerScrolls: |
| 277 settings->setRootLayerScrolls(true); | 277 settings->setRootLayerScrolls(true); |
| 278 break; | 278 break; |
| 279 } | 279 } |
| 280 } | 280 } |
| 281 }; | 281 }; |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 526 { | 526 { |
| 527 EvaluateOnLoadWebFrameClient webFrameClient; | 527 EvaluateOnLoadWebFrameClient webFrameClient; |
| 528 FrameTestHelpers::WebViewHelper webViewHelper(this); | 528 FrameTestHelpers::WebViewHelper webViewHelper(this); |
| 529 webViewHelper.initializeAndLoad("about:blank", true, &webFrameClient); | 529 webViewHelper.initializeAndLoad("about:blank", true, &webFrameClient); |
| 530 EXPECT_TRUE(webFrameClient.m_wasExecuted); | 530 EXPECT_TRUE(webFrameClient.m_wasExecuted); |
| 531 } | 531 } |
| 532 | 532 |
| 533 class CSSCallbackWebFrameClient : public FrameTestHelpers::TestWebFrameClient { | 533 class CSSCallbackWebFrameClient : public FrameTestHelpers::TestWebFrameClient { |
| 534 public: | 534 public: |
| 535 CSSCallbackWebFrameClient() : m_updateCount(0) { } | 535 CSSCallbackWebFrameClient() : m_updateCount(0) { } |
| 536 virtual void didMatchCSS(WebLocalFrame*, const WebVector<WebString>& newlyMa
tchingSelectors, const WebVector<WebString>& stoppedMatchingSelectors) override; | 536 void didMatchCSS(WebLocalFrame*, const WebVector<WebString>& newlyMatchingSe
lectors, const WebVector<WebString>& stoppedMatchingSelectors) override; |
| 537 | 537 |
| 538 std::map<WebLocalFrame*, std::set<std::string>> m_matchedSelectors; | 538 std::map<WebLocalFrame*, std::set<std::string>> m_matchedSelectors; |
| 539 int m_updateCount; | 539 int m_updateCount; |
| 540 }; | 540 }; |
| 541 | 541 |
| 542 void CSSCallbackWebFrameClient::didMatchCSS(WebLocalFrame* frame, const WebVecto
r<WebString>& newlyMatchingSelectors, const WebVector<WebString>& stoppedMatchin
gSelectors) | 542 void CSSCallbackWebFrameClient::didMatchCSS(WebLocalFrame* frame, const WebVecto
r<WebString>& newlyMatchingSelectors, const WebVector<WebString>& stoppedMatchin
gSelectors) |
| 543 { | 543 { |
| 544 ++m_updateCount; | 544 ++m_updateCount; |
| 545 std::set<std::string>& frameSelectors = m_matchedSelectors[frame]; | 545 std::set<std::string>& frameSelectors = m_matchedSelectors[frame]; |
| 546 for (size_t i = 0; i < newlyMatchingSelectors.size(); ++i) { | 546 for (size_t i = 0; i < newlyMatchingSelectors.size(); ++i) { |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 838 EXPECT_FALSE(exceptionState.hadException()); | 838 EXPECT_FALSE(exceptionState.hadException()); |
| 839 | 839 |
| 840 // Success is not crashing. | 840 // Success is not crashing. |
| 841 runPendingTasks(); | 841 runPendingTasks(); |
| 842 } | 842 } |
| 843 | 843 |
| 844 namespace { | 844 namespace { |
| 845 | 845 |
| 846 class FixedLayoutTestWebViewClient : public FrameTestHelpers::TestWebViewClient
{ | 846 class FixedLayoutTestWebViewClient : public FrameTestHelpers::TestWebViewClient
{ |
| 847 public: | 847 public: |
| 848 virtual WebScreenInfo screenInfo() override { return m_screenInfo; } | 848 WebScreenInfo screenInfo() override { return m_screenInfo; } |
| 849 | 849 |
| 850 WebScreenInfo m_screenInfo; | 850 WebScreenInfo m_screenInfo; |
| 851 }; | 851 }; |
| 852 | 852 |
| 853 class FakeCompositingWebViewClient : public FixedLayoutTestWebViewClient { | 853 class FakeCompositingWebViewClient : public FixedLayoutTestWebViewClient { |
| 854 }; | 854 }; |
| 855 | 855 |
| 856 // Viewport settings need to be set before the page gets loaded | 856 // Viewport settings need to be set before the page gets loaded |
| 857 void enableViewportSettings(WebSettings* settings) | 857 void enableViewportSettings(WebSettings* settings) |
| 858 { | 858 { |
| (...skipping 2307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3166 WebRect rect; | 3166 WebRect rect; |
| 3167 mainFrame->firstRectForCharacterRange(0, 5, rect); | 3167 mainFrame->firstRectForCharacterRange(0, 5, rect); |
| 3168 | 3168 |
| 3169 EXPECT_EQ((oldRect.x - pinchOffset.x) * scale, rect.x); | 3169 EXPECT_EQ((oldRect.x - pinchOffset.x) * scale, rect.x); |
| 3170 EXPECT_EQ((oldRect.y - pinchOffset.y) * scale, rect.y); | 3170 EXPECT_EQ((oldRect.y - pinchOffset.y) * scale, rect.y); |
| 3171 EXPECT_EQ(oldRect.width*scale, rect.width); | 3171 EXPECT_EQ(oldRect.width*scale, rect.width); |
| 3172 EXPECT_EQ(oldRect.height*scale, rect.height); | 3172 EXPECT_EQ(oldRect.height*scale, rect.height); |
| 3173 } | 3173 } |
| 3174 class TestReloadDoesntRedirectWebFrameClient : public FrameTestHelpers::TestWebF
rameClient { | 3174 class TestReloadDoesntRedirectWebFrameClient : public FrameTestHelpers::TestWebF
rameClient { |
| 3175 public: | 3175 public: |
| 3176 virtual WebNavigationPolicy decidePolicyForNavigation(const NavigationPolicy
Info& info) override | 3176 WebNavigationPolicy decidePolicyForNavigation(const NavigationPolicyInfo& in
fo) override |
| 3177 { | 3177 { |
| 3178 EXPECT_FALSE(info.isRedirect); | 3178 EXPECT_FALSE(info.isRedirect); |
| 3179 return WebNavigationPolicyCurrentTab; | 3179 return WebNavigationPolicyCurrentTab; |
| 3180 } | 3180 } |
| 3181 }; | 3181 }; |
| 3182 | 3182 |
| 3183 TEST_P(ParameterizedWebFrameTest, ReloadDoesntSetRedirect) | 3183 TEST_P(ParameterizedWebFrameTest, ReloadDoesntSetRedirect) |
| 3184 { | 3184 { |
| 3185 // Test for case in http://crbug.com/73104. Reloading a frame very quickly | 3185 // Test for case in http://crbug.com/73104. Reloading a frame very quickly |
| 3186 // would sometimes call decidePolicyForNavigation with isRedirect=true | 3186 // would sometimes call decidePolicyForNavigation with isRedirect=true |
| 3187 registerMockedHttpURLLoad("form.html"); | 3187 registerMockedHttpURLLoad("form.html"); |
| 3188 | 3188 |
| 3189 TestReloadDoesntRedirectWebFrameClient webFrameClient; | 3189 TestReloadDoesntRedirectWebFrameClient webFrameClient; |
| 3190 FrameTestHelpers::WebViewHelper webViewHelper(this); | 3190 FrameTestHelpers::WebViewHelper webViewHelper(this); |
| 3191 webViewHelper.initializeAndLoad(m_baseURL + "form.html", false, &webFrameCli
ent); | 3191 webViewHelper.initializeAndLoad(m_baseURL + "form.html", false, &webFrameCli
ent); |
| 3192 | 3192 |
| 3193 webViewHelper.webView()->mainFrame()->reload(true); | 3193 webViewHelper.webView()->mainFrame()->reload(true); |
| 3194 // start another reload before request is delivered. | 3194 // start another reload before request is delivered. |
| 3195 FrameTestHelpers::reloadFrameIgnoringCache(webViewHelper.webView()->mainFram
e()); | 3195 FrameTestHelpers::reloadFrameIgnoringCache(webViewHelper.webView()->mainFram
e()); |
| 3196 } | 3196 } |
| 3197 | 3197 |
| 3198 class ReloadWithOverrideURLTask : public WebThread::Task { | 3198 class ReloadWithOverrideURLTask : public WebThread::Task { |
| 3199 public: | 3199 public: |
| 3200 ReloadWithOverrideURLTask(WebFrame* frame, const KURL& url, bool ignoreCache
) | 3200 ReloadWithOverrideURLTask(WebFrame* frame, const KURL& url, bool ignoreCache
) |
| 3201 : m_frame(frame), m_url(url), m_ignoreCache(ignoreCache) | 3201 : m_frame(frame), m_url(url), m_ignoreCache(ignoreCache) |
| 3202 { | 3202 { |
| 3203 } | 3203 } |
| 3204 | 3204 |
| 3205 virtual void run() override | 3205 void run() override |
| 3206 { | 3206 { |
| 3207 m_frame->reloadWithOverrideURL(m_url, m_ignoreCache); | 3207 m_frame->reloadWithOverrideURL(m_url, m_ignoreCache); |
| 3208 } | 3208 } |
| 3209 | 3209 |
| 3210 private: | 3210 private: |
| 3211 WebFrame* const m_frame; | 3211 WebFrame* const m_frame; |
| 3212 const KURL m_url; | 3212 const KURL m_url; |
| 3213 const bool m_ignoreCache; | 3213 const bool m_ignoreCache; |
| 3214 }; | 3214 }; |
| 3215 | 3215 |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3365 bool Equals(Notification* other) | 3365 bool Equals(Notification* other) |
| 3366 { | 3366 { |
| 3367 return other && frame == other->frame && context == other->context &
& worldId == other->worldId; | 3367 return other && frame == other->frame && context == other->context &
& worldId == other->worldId; |
| 3368 } | 3368 } |
| 3369 | 3369 |
| 3370 WebLocalFrame* frame; | 3370 WebLocalFrame* frame; |
| 3371 v8::Persistent<v8::Context> context; | 3371 v8::Persistent<v8::Context> context; |
| 3372 int worldId; | 3372 int worldId; |
| 3373 }; | 3373 }; |
| 3374 | 3374 |
| 3375 virtual ~ContextLifetimeTestWebFrameClient() | 3375 ~ContextLifetimeTestWebFrameClient() override |
| 3376 { | 3376 { |
| 3377 reset(); | 3377 reset(); |
| 3378 } | 3378 } |
| 3379 | 3379 |
| 3380 void reset() | 3380 void reset() |
| 3381 { | 3381 { |
| 3382 for (size_t i = 0; i < createNotifications.size(); ++i) | 3382 for (size_t i = 0; i < createNotifications.size(); ++i) |
| 3383 delete createNotifications[i]; | 3383 delete createNotifications[i]; |
| 3384 | 3384 |
| 3385 for (size_t i = 0; i < releaseNotifications.size(); ++i) | 3385 for (size_t i = 0; i < releaseNotifications.size(); ++i) |
| 3386 delete releaseNotifications[i]; | 3386 delete releaseNotifications[i]; |
| 3387 | 3387 |
| 3388 createNotifications.clear(); | 3388 createNotifications.clear(); |
| 3389 releaseNotifications.clear(); | 3389 releaseNotifications.clear(); |
| 3390 } | 3390 } |
| 3391 | 3391 |
| 3392 std::vector<Notification*> createNotifications; | 3392 std::vector<Notification*> createNotifications; |
| 3393 std::vector<Notification*> releaseNotifications; | 3393 std::vector<Notification*> releaseNotifications; |
| 3394 | 3394 |
| 3395 private: | 3395 private: |
| 3396 virtual void didCreateScriptContext(WebLocalFrame* frame, v8::Local<v8::Cont
ext> context, int extensionGroup, int worldId) override | 3396 void didCreateScriptContext(WebLocalFrame* frame, v8::Local<v8::Context> con
text, int extensionGroup, int worldId) override |
| 3397 { | 3397 { |
| 3398 createNotifications.push_back(new Notification(frame, context, worldId))
; | 3398 createNotifications.push_back(new Notification(frame, context, worldId))
; |
| 3399 } | 3399 } |
| 3400 | 3400 |
| 3401 virtual void willReleaseScriptContext(WebLocalFrame* frame, v8::Local<v8::Co
ntext> context, int worldId) override | 3401 void willReleaseScriptContext(WebLocalFrame* frame, v8::Local<v8::Context> c
ontext, int worldId) override |
| 3402 { | 3402 { |
| 3403 releaseNotifications.push_back(new Notification(frame, context, worldId)
); | 3403 releaseNotifications.push_back(new Notification(frame, context, worldId)
); |
| 3404 } | 3404 } |
| 3405 }; | 3405 }; |
| 3406 | 3406 |
| 3407 // TODO(aa): Deflake this test. | 3407 // TODO(aa): Deflake this test. |
| 3408 TEST_P(ParameterizedWebFrameTest, FLAKY_ContextNotificationsLoadUnload) | 3408 TEST_P(ParameterizedWebFrameTest, FLAKY_ContextNotificationsLoadUnload) |
| 3409 { | 3409 { |
| 3410 v8::HandleScope handleScope(v8::Isolate::GetCurrent()); | 3410 v8::HandleScope handleScope(v8::Isolate::GetCurrent()); |
| 3411 | 3411 |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3654 frame->executeCommand(WebString::fromUTF8("SelectAll")); | 3654 frame->executeCommand(WebString::fromUTF8("SelectAll")); |
| 3655 EXPECT_TRUE(frame->hasSelection()); | 3655 EXPECT_TRUE(frame->hasSelection()); |
| 3656 frame->executeCommand(WebString::fromUTF8("Unselect")); | 3656 frame->executeCommand(WebString::fromUTF8("Unselect")); |
| 3657 EXPECT_FALSE(frame->hasSelection()); | 3657 EXPECT_FALSE(frame->hasSelection()); |
| 3658 WebString selectionHtml = frame->selectionAsMarkup(); | 3658 WebString selectionHtml = frame->selectionAsMarkup(); |
| 3659 EXPECT_TRUE(selectionHtml.isEmpty()); | 3659 EXPECT_TRUE(selectionHtml.isEmpty()); |
| 3660 } | 3660 } |
| 3661 | 3661 |
| 3662 class TestExecuteScriptDuringDidCreateScriptContext : public FrameTestHelpers::T
estWebFrameClient { | 3662 class TestExecuteScriptDuringDidCreateScriptContext : public FrameTestHelpers::T
estWebFrameClient { |
| 3663 public: | 3663 public: |
| 3664 virtual void didCreateScriptContext(WebLocalFrame* frame, v8::Local<v8::Cont
ext> context, int extensionGroup, int worldId) override | 3664 void didCreateScriptContext(WebLocalFrame* frame, v8::Local<v8::Context> con
text, int extensionGroup, int worldId) override |
| 3665 { | 3665 { |
| 3666 frame->executeScript(WebScriptSource("window.history = 'replaced';")); | 3666 frame->executeScript(WebScriptSource("window.history = 'replaced';")); |
| 3667 } | 3667 } |
| 3668 }; | 3668 }; |
| 3669 | 3669 |
| 3670 TEST_P(ParameterizedWebFrameTest, ExecuteScriptDuringDidCreateScriptContext) | 3670 TEST_P(ParameterizedWebFrameTest, ExecuteScriptDuringDidCreateScriptContext) |
| 3671 { | 3671 { |
| 3672 registerMockedHttpURLLoad("hello_world.html"); | 3672 registerMockedHttpURLLoad("hello_world.html"); |
| 3673 | 3673 |
| 3674 TestExecuteScriptDuringDidCreateScriptContext webFrameClient; | 3674 TestExecuteScriptDuringDidCreateScriptContext webFrameClient; |
| 3675 FrameTestHelpers::WebViewHelper webViewHelper(this); | 3675 FrameTestHelpers::WebViewHelper webViewHelper(this); |
| 3676 webViewHelper.initializeAndLoad(m_baseURL + "hello_world.html", true, &webFr
ameClient); | 3676 webViewHelper.initializeAndLoad(m_baseURL + "hello_world.html", true, &webFr
ameClient); |
| 3677 | 3677 |
| 3678 FrameTestHelpers::reloadFrame(webViewHelper.webView()->mainFrame()); | 3678 FrameTestHelpers::reloadFrame(webViewHelper.webView()->mainFrame()); |
| 3679 } | 3679 } |
| 3680 | 3680 |
| 3681 class FindUpdateWebFrameClient : public FrameTestHelpers::TestWebFrameClient { | 3681 class FindUpdateWebFrameClient : public FrameTestHelpers::TestWebFrameClient { |
| 3682 public: | 3682 public: |
| 3683 FindUpdateWebFrameClient() | 3683 FindUpdateWebFrameClient() |
| 3684 : m_findResultsAreReady(false) | 3684 : m_findResultsAreReady(false) |
| 3685 , m_count(-1) | 3685 , m_count(-1) |
| 3686 { | 3686 { |
| 3687 } | 3687 } |
| 3688 | 3688 |
| 3689 virtual void reportFindInPageMatchCount(int, int count, bool finalUpdate) ov
erride | 3689 void reportFindInPageMatchCount(int, int count, bool finalUpdate) override |
| 3690 { | 3690 { |
| 3691 m_count = count; | 3691 m_count = count; |
| 3692 if (finalUpdate) | 3692 if (finalUpdate) |
| 3693 m_findResultsAreReady = true; | 3693 m_findResultsAreReady = true; |
| 3694 } | 3694 } |
| 3695 | 3695 |
| 3696 bool findResultsAreReady() const { return m_findResultsAreReady; } | 3696 bool findResultsAreReady() const { return m_findResultsAreReady; } |
| 3697 int count() const { return m_count; } | 3697 int count() const { return m_count; } |
| 3698 | 3698 |
| 3699 private: | 3699 private: |
| (...skipping 770 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4470 frame->moveCaretSelection(moveTo); | 4470 frame->moveCaretSelection(moveTo); |
| 4471 webViewHelper.webView()->selectionBounds(startRect, endRect); | 4471 webViewHelper.webView()->selectionBounds(startRect, endRect); |
| 4472 EXPECT_EQ(startRect, initialStartRect); | 4472 EXPECT_EQ(startRect, initialStartRect); |
| 4473 EXPECT_EQ(endRect, initialEndRect); | 4473 EXPECT_EQ(endRect, initialEndRect); |
| 4474 } | 4474 } |
| 4475 #endif | 4475 #endif |
| 4476 | 4476 |
| 4477 class CompositedSelectionBoundsTestLayerTreeView : public WebLayerTreeView { | 4477 class CompositedSelectionBoundsTestLayerTreeView : public WebLayerTreeView { |
| 4478 public: | 4478 public: |
| 4479 CompositedSelectionBoundsTestLayerTreeView() : m_selectionCleared(false) { } | 4479 CompositedSelectionBoundsTestLayerTreeView() : m_selectionCleared(false) { } |
| 4480 virtual ~CompositedSelectionBoundsTestLayerTreeView() { } | 4480 ~CompositedSelectionBoundsTestLayerTreeView() override { } |
| 4481 | 4481 |
| 4482 virtual void setRootLayer(const WebLayer&) override { } | 4482 void setRootLayer(const WebLayer&) override { } |
| 4483 virtual void clearRootLayer() override { } | 4483 void clearRootLayer() override { } |
| 4484 virtual void setViewportSize(const WebSize& deviceViewportSize) override {
} | 4484 void setViewportSize(const WebSize& deviceViewportSize) override { } |
| 4485 virtual WebSize deviceViewportSize() const override { return WebSize(); } | 4485 WebSize deviceViewportSize() const override { return WebSize(); } |
| 4486 virtual void setDeviceScaleFactor(float) override { } | 4486 void setDeviceScaleFactor(float) override { } |
| 4487 virtual float deviceScaleFactor() const override { return 1.f; } | 4487 float deviceScaleFactor() const override { return 1.f; } |
| 4488 virtual void setBackgroundColor(WebColor) override { } | 4488 void setBackgroundColor(WebColor) override { } |
| 4489 virtual void setHasTransparentBackground(bool) override { } | 4489 void setHasTransparentBackground(bool) override { } |
| 4490 virtual void setVisible(bool) override { } | 4490 void setVisible(bool) override { } |
| 4491 virtual void setPageScaleFactorAndLimits(float pageScaleFactor, float minimu
m, float maximum) override { } | 4491 void setPageScaleFactorAndLimits(float pageScaleFactor, float minimum, float
maximum) override { } |
| 4492 virtual void startPageScaleAnimation(const WebPoint& destination, bool useAn
chor, float newPageScale, double durationSec) override { } | 4492 void startPageScaleAnimation(const WebPoint& destination, bool useAnchor, fl
oat newPageScale, double durationSec) override { } |
| 4493 virtual void setNeedsAnimate() override { } | 4493 void setNeedsAnimate() override { } |
| 4494 virtual void finishAllRendering() override { } | 4494 void finishAllRendering() override { } |
| 4495 virtual void registerSelection(const WebSelection& selection) override | 4495 void registerSelection(const WebSelection& selection) override |
| 4496 { | 4496 { |
| 4497 m_selection = adoptPtr(new WebSelection(selection)); | 4497 m_selection = adoptPtr(new WebSelection(selection)); |
| 4498 } | 4498 } |
| 4499 virtual void clearSelection() override | 4499 void clearSelection() override |
| 4500 { | 4500 { |
| 4501 m_selectionCleared = true; | 4501 m_selectionCleared = true; |
| 4502 m_selection.clear(); | 4502 m_selection.clear(); |
| 4503 } | 4503 } |
| 4504 | 4504 |
| 4505 bool getAndResetSelectionCleared() | 4505 bool getAndResetSelectionCleared() |
| 4506 { | 4506 { |
| 4507 bool selectionCleared = m_selectionCleared; | 4507 bool selectionCleared = m_selectionCleared; |
| 4508 m_selectionCleared = false; | 4508 m_selectionCleared = false; |
| 4509 return selectionCleared; | 4509 return selectionCleared; |
| 4510 } | 4510 } |
| 4511 | 4511 |
| 4512 const WebSelection* selection() const { return m_selection.get(); } | 4512 const WebSelection* selection() const { return m_selection.get(); } |
| 4513 const WebSelectionBound* start() const { return m_selection ? &m_selection->
start() : nullptr; } | 4513 const WebSelectionBound* start() const { return m_selection ? &m_selection->
start() : nullptr; } |
| 4514 const WebSelectionBound* end() const { return m_selection ? &m_selection->en
d() : nullptr; } | 4514 const WebSelectionBound* end() const { return m_selection ? &m_selection->en
d() : nullptr; } |
| 4515 | 4515 |
| 4516 private: | 4516 private: |
| 4517 bool m_selectionCleared; | 4517 bool m_selectionCleared; |
| 4518 OwnPtr<WebSelection> m_selection; | 4518 OwnPtr<WebSelection> m_selection; |
| 4519 }; | 4519 }; |
| 4520 | 4520 |
| 4521 class CompositedSelectionBoundsTestWebViewClient : public FrameTestHelpers::Test
WebViewClient { | 4521 class CompositedSelectionBoundsTestWebViewClient : public FrameTestHelpers::Test
WebViewClient { |
| 4522 public: | 4522 public: |
| 4523 virtual ~CompositedSelectionBoundsTestWebViewClient() { } | 4523 ~CompositedSelectionBoundsTestWebViewClient() override {} |
| 4524 virtual WebLayerTreeView* layerTreeView() override { return &m_testLayerTree
View; } | 4524 WebLayerTreeView* layerTreeView() override { return &m_testLayerTreeView; } |
| 4525 | 4525 |
| 4526 CompositedSelectionBoundsTestLayerTreeView& selectionLayerTreeView() { retur
n m_testLayerTreeView; } | 4526 CompositedSelectionBoundsTestLayerTreeView& selectionLayerTreeView() { retur
n m_testLayerTreeView; } |
| 4527 | 4527 |
| 4528 private: | 4528 private: |
| 4529 CompositedSelectionBoundsTestLayerTreeView m_testLayerTreeView; | 4529 CompositedSelectionBoundsTestLayerTreeView m_testLayerTreeView; |
| 4530 }; | 4530 }; |
| 4531 | 4531 |
| 4532 class CompositedSelectionBoundsTest : public WebFrameTest { | 4532 class CompositedSelectionBoundsTest : public WebFrameTest { |
| 4533 protected: | 4533 protected: |
| 4534 CompositedSelectionBoundsTest() | 4534 CompositedSelectionBoundsTest() |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4688 | 4688 |
| 4689 frame = webViewHelper.webView()->mainFrame(); | 4689 frame = webViewHelper.webView()->mainFrame(); |
| 4690 frame->executeCommand(WebString::fromUTF8("Unselect")); | 4690 frame->executeCommand(WebString::fromUTF8("Unselect")); |
| 4691 webViewHelper.webView()->layout(); | 4691 webViewHelper.webView()->layout(); |
| 4692 ASSERT_FALSE(frame->hasSelection()); | 4692 ASSERT_FALSE(frame->hasSelection()); |
| 4693 EXPECT_TRUE(fakeSelectionLayerTreeView.getAndResetSelectionCleared()); | 4693 EXPECT_TRUE(fakeSelectionLayerTreeView.getAndResetSelectionCleared()); |
| 4694 } | 4694 } |
| 4695 | 4695 |
| 4696 class DisambiguationPopupTestWebViewClient : public FrameTestHelpers::TestWebVie
wClient { | 4696 class DisambiguationPopupTestWebViewClient : public FrameTestHelpers::TestWebVie
wClient { |
| 4697 public: | 4697 public: |
| 4698 virtual bool didTapMultipleTargets(const WebSize&, const WebRect&, const Web
Vector<WebRect>& targetRects) override | 4698 bool didTapMultipleTargets(const WebSize&, const WebRect&, const WebVector<W
ebRect>& targetRects) override |
| 4699 { | 4699 { |
| 4700 EXPECT_GE(targetRects.size(), 2u); | 4700 EXPECT_GE(targetRects.size(), 2u); |
| 4701 m_triggered = true; | 4701 m_triggered = true; |
| 4702 return true; | 4702 return true; |
| 4703 } | 4703 } |
| 4704 | 4704 |
| 4705 bool triggered() const { return m_triggered; } | 4705 bool triggered() const { return m_triggered; } |
| 4706 void resetTriggered() { m_triggered = false; } | 4706 void resetTriggered() { m_triggered = false; } |
| 4707 bool m_triggered; | 4707 bool m_triggered; |
| 4708 }; | 4708 }; |
| (...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5035 EXPECT_EQ("This should appear", text.utf8()); | 5035 EXPECT_EQ("This should appear", text.utf8()); |
| 5036 EXPECT_TRUE(webFrameClient.commitCalled()); | 5036 EXPECT_TRUE(webFrameClient.commitCalled()); |
| 5037 } | 5037 } |
| 5038 | 5038 |
| 5039 class TestWillInsertBodyWebFrameClient : public FrameTestHelpers::TestWebFrameCl
ient { | 5039 class TestWillInsertBodyWebFrameClient : public FrameTestHelpers::TestWebFrameCl
ient { |
| 5040 public: | 5040 public: |
| 5041 TestWillInsertBodyWebFrameClient() : m_numBodies(0), m_didLoad(false) | 5041 TestWillInsertBodyWebFrameClient() : m_numBodies(0), m_didLoad(false) |
| 5042 { | 5042 { |
| 5043 } | 5043 } |
| 5044 | 5044 |
| 5045 virtual void didCommitProvisionalLoad(WebLocalFrame*, const WebHistoryItem&,
WebHistoryCommitType) override | 5045 void didCommitProvisionalLoad(WebLocalFrame*, const WebHistoryItem&, WebHist
oryCommitType) override |
| 5046 { | 5046 { |
| 5047 m_numBodies = 0; | 5047 m_numBodies = 0; |
| 5048 m_didLoad = true; | 5048 m_didLoad = true; |
| 5049 } | 5049 } |
| 5050 | 5050 |
| 5051 virtual void didCreateDocumentElement(WebLocalFrame*) override | 5051 void didCreateDocumentElement(WebLocalFrame*) override |
| 5052 { | 5052 { |
| 5053 EXPECT_EQ(0, m_numBodies); | 5053 EXPECT_EQ(0, m_numBodies); |
| 5054 } | 5054 } |
| 5055 | 5055 |
| 5056 virtual void willInsertBody(WebLocalFrame*) override | 5056 void willInsertBody(WebLocalFrame*) override |
| 5057 { | 5057 { |
| 5058 m_numBodies++; | 5058 m_numBodies++; |
| 5059 } | 5059 } |
| 5060 | 5060 |
| 5061 int m_numBodies; | 5061 int m_numBodies; |
| 5062 bool m_didLoad; | 5062 bool m_didLoad; |
| 5063 }; | 5063 }; |
| 5064 | 5064 |
| 5065 TEST_P(ParameterizedWebFrameTest, HTMLDocument) | 5065 TEST_P(ParameterizedWebFrameTest, HTMLDocument) |
| 5066 { | 5066 { |
| (...skipping 26 matching lines...) Expand all Loading... |
| 5093 WebFrame* frame = webViewHelper.webView()->mainFrame(); | 5093 WebFrame* frame = webViewHelper.webView()->mainFrame(); |
| 5094 | 5094 |
| 5095 // This test passes if this doesn't crash. | 5095 // This test passes if this doesn't crash. |
| 5096 frame->moveCaretSelection(WebPoint(0, 0)); | 5096 frame->moveCaretSelection(WebPoint(0, 0)); |
| 5097 } | 5097 } |
| 5098 | 5098 |
| 5099 class SpellCheckClient : public WebSpellCheckClient { | 5099 class SpellCheckClient : public WebSpellCheckClient { |
| 5100 public: | 5100 public: |
| 5101 explicit SpellCheckClient(uint32_t hash = 0) : m_numberOfTimesChecked(0), m_
hash(hash) { } | 5101 explicit SpellCheckClient(uint32_t hash = 0) : m_numberOfTimesChecked(0), m_
hash(hash) { } |
| 5102 virtual ~SpellCheckClient() { } | 5102 virtual ~SpellCheckClient() { } |
| 5103 virtual void requestCheckingOfText(const WebString&, const WebVector<uint32_
t>&, const WebVector<unsigned>&, WebTextCheckingCompletion* completion) override | 5103 void requestCheckingOfText(const WebString&, const WebVector<uint32_t>&, con
st WebVector<unsigned>&, WebTextCheckingCompletion* completion) override |
| 5104 { | 5104 { |
| 5105 ++m_numberOfTimesChecked; | 5105 ++m_numberOfTimesChecked; |
| 5106 Vector<WebTextCheckingResult> results; | 5106 Vector<WebTextCheckingResult> results; |
| 5107 const int misspellingStartOffset = 1; | 5107 const int misspellingStartOffset = 1; |
| 5108 const int misspellingLength = 8; | 5108 const int misspellingLength = 8; |
| 5109 results.append(WebTextCheckingResult(WebTextDecorationTypeSpelling, miss
pellingStartOffset, misspellingLength, WebString(), m_hash)); | 5109 results.append(WebTextCheckingResult(WebTextDecorationTypeSpelling, miss
pellingStartOffset, misspellingLength, WebString(), m_hash)); |
| 5110 completion->didFinishCheckingText(results); | 5110 completion->didFinishCheckingText(results); |
| 5111 } | 5111 } |
| 5112 int numberOfTimesChecked() const { return m_numberOfTimesChecked; } | 5112 int numberOfTimesChecked() const { return m_numberOfTimesChecked; } |
| 5113 private: | 5113 private: |
| (...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5593 class TestScrolledFrameClient : public FrameTestHelpers::TestWebFrameClient { | 5593 class TestScrolledFrameClient : public FrameTestHelpers::TestWebFrameClient { |
| 5594 public: | 5594 public: |
| 5595 TestScrolledFrameClient() { reset(); } | 5595 TestScrolledFrameClient() { reset(); } |
| 5596 void reset() | 5596 void reset() |
| 5597 { | 5597 { |
| 5598 m_didScrollFrame = false; | 5598 m_didScrollFrame = false; |
| 5599 } | 5599 } |
| 5600 bool wasFrameScrolled() const { return m_didScrollFrame; } | 5600 bool wasFrameScrolled() const { return m_didScrollFrame; } |
| 5601 | 5601 |
| 5602 // WebFrameClient: | 5602 // WebFrameClient: |
| 5603 virtual void didChangeScrollOffset(WebLocalFrame* frame) override | 5603 void didChangeScrollOffset(WebLocalFrame* frame) override |
| 5604 { | 5604 { |
| 5605 if (frame->parent()) | 5605 if (frame->parent()) |
| 5606 return; | 5606 return; |
| 5607 EXPECT_FALSE(m_didScrollFrame); | 5607 EXPECT_FALSE(m_didScrollFrame); |
| 5608 FrameView* view = toWebLocalFrameImpl(frame)->frameView(); | 5608 FrameView* view = toWebLocalFrameImpl(frame)->frameView(); |
| 5609 // FrameView can be scrolled in FrameView::setFixedVisibleContentRect | 5609 // FrameView can be scrolled in FrameView::setFixedVisibleContentRect |
| 5610 // which is called from LocalFrame::createView (before the frame is asso
ciated | 5610 // which is called from LocalFrame::createView (before the frame is asso
ciated |
| 5611 // with the the view). | 5611 // with the the view). |
| 5612 if (view) | 5612 if (view) |
| 5613 m_didScrollFrame = true; | 5613 m_didScrollFrame = true; |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5696 Platform::current()->unitTestSupport()->registerMockedURL(redirectURL, final
Response, filePath); | 5696 Platform::current()->unitTestSupport()->registerMockedURL(redirectURL, final
Response, filePath); |
| 5697 | 5697 |
| 5698 FrameTestHelpers::WebViewHelper webViewHelper(this); | 5698 FrameTestHelpers::WebViewHelper webViewHelper(this); |
| 5699 webViewHelper.initializeAndLoad(m_baseURL + "first_party_redirect.html", tru
e); | 5699 webViewHelper.initializeAndLoad(m_baseURL + "first_party_redirect.html", tru
e); |
| 5700 EXPECT_TRUE(webViewHelper.webView()->mainFrame()->document().firstPartyForCo
okies() == redirectURL); | 5700 EXPECT_TRUE(webViewHelper.webView()->mainFrame()->document().firstPartyForCo
okies() == redirectURL); |
| 5701 } | 5701 } |
| 5702 | 5702 |
| 5703 class TestNavigationPolicyWebFrameClient : public FrameTestHelpers::TestWebFrame
Client { | 5703 class TestNavigationPolicyWebFrameClient : public FrameTestHelpers::TestWebFrame
Client { |
| 5704 public: | 5704 public: |
| 5705 | 5705 |
| 5706 virtual void didNavigateWithinPage(WebLocalFrame*, const WebHistoryItem&, We
bHistoryCommitType) override | 5706 void didNavigateWithinPage(WebLocalFrame*, const WebHistoryItem&, WebHistory
CommitType) override |
| 5707 { | 5707 { |
| 5708 EXPECT_TRUE(false); | 5708 EXPECT_TRUE(false); |
| 5709 } | 5709 } |
| 5710 }; | 5710 }; |
| 5711 | 5711 |
| 5712 TEST_P(ParameterizedWebFrameTest, SimulateFragmentAnchorMiddleClick) | 5712 TEST_P(ParameterizedWebFrameTest, SimulateFragmentAnchorMiddleClick) |
| 5713 { | 5713 { |
| 5714 registerMockedHttpURLLoad("fragment_middle_click.html"); | 5714 registerMockedHttpURLLoad("fragment_middle_click.html"); |
| 5715 TestNavigationPolicyWebFrameClient client; | 5715 TestNavigationPolicyWebFrameClient client; |
| 5716 FrameTestHelpers::WebViewHelper webViewHelper(this); | 5716 FrameTestHelpers::WebViewHelper webViewHelper(this); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 5737 } | 5737 } |
| 5738 }; | 5738 }; |
| 5739 | 5739 |
| 5740 class TestNewWindowWebFrameClient : public FrameTestHelpers::TestWebFrameClient
{ | 5740 class TestNewWindowWebFrameClient : public FrameTestHelpers::TestWebFrameClient
{ |
| 5741 public: | 5741 public: |
| 5742 TestNewWindowWebFrameClient() | 5742 TestNewWindowWebFrameClient() |
| 5743 : m_decidePolicyCallCount(0) | 5743 : m_decidePolicyCallCount(0) |
| 5744 { | 5744 { |
| 5745 } | 5745 } |
| 5746 | 5746 |
| 5747 virtual WebNavigationPolicy decidePolicyForNavigation(const NavigationPolicy
Info& info) override | 5747 WebNavigationPolicy decidePolicyForNavigation(const NavigationPolicyInfo& in
fo) override |
| 5748 { | 5748 { |
| 5749 m_decidePolicyCallCount++; | 5749 m_decidePolicyCallCount++; |
| 5750 return info.defaultPolicy; | 5750 return info.defaultPolicy; |
| 5751 } | 5751 } |
| 5752 | 5752 |
| 5753 int decidePolicyCallCount() const { return m_decidePolicyCallCount; } | 5753 int decidePolicyCallCount() const { return m_decidePolicyCallCount; } |
| 5754 | 5754 |
| 5755 private: | 5755 private: |
| 5756 int m_decidePolicyCallCount; | 5756 int m_decidePolicyCallCount; |
| 5757 }; | 5757 }; |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5903 | 5903 |
| 5904 virtual void didStopLoading() | 5904 virtual void didStopLoading() |
| 5905 { | 5905 { |
| 5906 if (m_parentClient) { | 5906 if (m_parentClient) { |
| 5907 m_parentClient->didStopLoading(); | 5907 m_parentClient->didStopLoading(); |
| 5908 return; | 5908 return; |
| 5909 } | 5909 } |
| 5910 TestWebFrameClient::didStopLoading(); | 5910 TestWebFrameClient::didStopLoading(); |
| 5911 } | 5911 } |
| 5912 | 5912 |
| 5913 virtual void willSendRequest(WebLocalFrame* frame, unsigned, WebURLRequest&
request, const WebURLResponse&) override | 5913 void willSendRequest(WebLocalFrame* frame, unsigned, WebURLRequest& request,
const WebURLResponse&) override |
| 5914 { | 5914 { |
| 5915 m_policy = request.cachePolicy(); | 5915 m_policy = request.cachePolicy(); |
| 5916 m_willSendRequestCallCount++; | 5916 m_willSendRequestCallCount++; |
| 5917 } | 5917 } |
| 5918 | 5918 |
| 5919 private: | 5919 private: |
| 5920 TestCachePolicyWebFrameClient* m_parentClient; | 5920 TestCachePolicyWebFrameClient* m_parentClient; |
| 5921 | 5921 |
| 5922 WebURLRequest::CachePolicy m_policy; | 5922 WebURLRequest::CachePolicy m_policy; |
| 5923 TestCachePolicyWebFrameClient* m_childClient; | 5923 TestCachePolicyWebFrameClient* m_childClient; |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6051 | 6051 |
| 6052 class TestStartStopCallbackWebFrameClient : public FrameTestHelpers::TestWebFram
eClient { | 6052 class TestStartStopCallbackWebFrameClient : public FrameTestHelpers::TestWebFram
eClient { |
| 6053 public: | 6053 public: |
| 6054 TestStartStopCallbackWebFrameClient() | 6054 TestStartStopCallbackWebFrameClient() |
| 6055 : m_startLoadingCount(0) | 6055 : m_startLoadingCount(0) |
| 6056 , m_stopLoadingCount(0) | 6056 , m_stopLoadingCount(0) |
| 6057 , m_differentDocumentStartCount(0) | 6057 , m_differentDocumentStartCount(0) |
| 6058 { | 6058 { |
| 6059 } | 6059 } |
| 6060 | 6060 |
| 6061 virtual void didStartLoading(bool toDifferentDocument) override | 6061 void didStartLoading(bool toDifferentDocument) override |
| 6062 { | 6062 { |
| 6063 TestWebFrameClient::didStartLoading(toDifferentDocument); | 6063 TestWebFrameClient::didStartLoading(toDifferentDocument); |
| 6064 m_startLoadingCount++; | 6064 m_startLoadingCount++; |
| 6065 if (toDifferentDocument) | 6065 if (toDifferentDocument) |
| 6066 m_differentDocumentStartCount++; | 6066 m_differentDocumentStartCount++; |
| 6067 } | 6067 } |
| 6068 | 6068 |
| 6069 virtual void didStopLoading() override | 6069 void didStopLoading() override |
| 6070 { | 6070 { |
| 6071 TestWebFrameClient::didStopLoading(); | 6071 TestWebFrameClient::didStopLoading(); |
| 6072 m_stopLoadingCount++; | 6072 m_stopLoadingCount++; |
| 6073 } | 6073 } |
| 6074 | 6074 |
| 6075 int startLoadingCount() const { return m_startLoadingCount; } | 6075 int startLoadingCount() const { return m_startLoadingCount; } |
| 6076 int stopLoadingCount() const { return m_stopLoadingCount; } | 6076 int stopLoadingCount() const { return m_stopLoadingCount; } |
| 6077 int differentDocumentStartCount() const { return m_differentDocumentStartCou
nt; } | 6077 int differentDocumentStartCount() const { return m_differentDocumentStartCou
nt; } |
| 6078 | 6078 |
| 6079 private: | 6079 private: |
| (...skipping 14 matching lines...) Expand all Loading... |
| 6094 EXPECT_EQ(client.differentDocumentStartCount(), 1); | 6094 EXPECT_EQ(client.differentDocumentStartCount(), 1); |
| 6095 } | 6095 } |
| 6096 | 6096 |
| 6097 class TestDidNavigateCommitTypeWebFrameClient : public FrameTestHelpers::TestWeb
FrameClient { | 6097 class TestDidNavigateCommitTypeWebFrameClient : public FrameTestHelpers::TestWeb
FrameClient { |
| 6098 public: | 6098 public: |
| 6099 TestDidNavigateCommitTypeWebFrameClient() | 6099 TestDidNavigateCommitTypeWebFrameClient() |
| 6100 : m_lastCommitType(WebHistoryInertCommit) | 6100 : m_lastCommitType(WebHistoryInertCommit) |
| 6101 { | 6101 { |
| 6102 } | 6102 } |
| 6103 | 6103 |
| 6104 virtual void didNavigateWithinPage(WebLocalFrame*, const WebHistoryItem&, We
bHistoryCommitType type) override | 6104 void didNavigateWithinPage(WebLocalFrame*, const WebHistoryItem&, WebHistory
CommitType type) override |
| 6105 { | 6105 { |
| 6106 m_lastCommitType = type; | 6106 m_lastCommitType = type; |
| 6107 } | 6107 } |
| 6108 | 6108 |
| 6109 WebHistoryCommitType lastCommitType() const { return m_lastCommitType; } | 6109 WebHistoryCommitType lastCommitType() const { return m_lastCommitType; } |
| 6110 | 6110 |
| 6111 private: | 6111 private: |
| 6112 WebHistoryCommitType m_lastCommitType; | 6112 WebHistoryCommitType m_lastCommitType; |
| 6113 }; | 6113 }; |
| 6114 | 6114 |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6265 // After commit, there is. | 6265 // After commit, there is. |
| 6266 HistoryItem* item = mainFrameLoader.currentItem(); | 6266 HistoryItem* item = mainFrameLoader.currentItem(); |
| 6267 ASSERT_TRUE(item); | 6267 ASSERT_TRUE(item); |
| 6268 EXPECT_EQ(WTF::String(url.data()), item->urlString()); | 6268 EXPECT_EQ(WTF::String(url.data()), item->urlString()); |
| 6269 } | 6269 } |
| 6270 | 6270 |
| 6271 class FailCreateChildFrame : public FrameTestHelpers::TestWebFrameClient { | 6271 class FailCreateChildFrame : public FrameTestHelpers::TestWebFrameClient { |
| 6272 public: | 6272 public: |
| 6273 FailCreateChildFrame() : m_callCount(0) { } | 6273 FailCreateChildFrame() : m_callCount(0) { } |
| 6274 | 6274 |
| 6275 virtual WebFrame* createChildFrame(WebLocalFrame* parent, WebTreeScopeType s
cope, const WebString& frameName, WebSandboxFlags sandboxFlags) override | 6275 WebFrame* createChildFrame(WebLocalFrame* parent, WebTreeScopeType scope, co
nst WebString& frameName, WebSandboxFlags sandboxFlags) override |
| 6276 { | 6276 { |
| 6277 ++m_callCount; | 6277 ++m_callCount; |
| 6278 return 0; | 6278 return 0; |
| 6279 } | 6279 } |
| 6280 | 6280 |
| 6281 int callCount() const { return m_callCount; } | 6281 int callCount() const { return m_callCount; } |
| 6282 | 6282 |
| 6283 private: | 6283 private: |
| 6284 int m_callCount; | 6284 int m_callCount; |
| 6285 }; | 6285 }; |
| (...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6696 FrameTestHelpers::WebViewHelper webViewHelper(this); | 6696 FrameTestHelpers::WebViewHelper webViewHelper(this); |
| 6697 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(m_baseURL + "hidd
en_frames.html"); | 6697 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(m_baseURL + "hidd
en_frames.html"); |
| 6698 for (WebFrame* frame = webViewImpl->mainFrameImpl()->traverseNext(false); fr
ame; frame = frame->traverseNext(false)) { | 6698 for (WebFrame* frame = webViewImpl->mainFrameImpl()->traverseNext(false); fr
ame; frame = frame->traverseNext(false)) { |
| 6699 EXPECT_FALSE(frame->hasVisibleContent()); | 6699 EXPECT_FALSE(frame->hasVisibleContent()); |
| 6700 } | 6700 } |
| 6701 } | 6701 } |
| 6702 | 6702 |
| 6703 class ManifestChangeWebFrameClient : public FrameTestHelpers::TestWebFrameClient
{ | 6703 class ManifestChangeWebFrameClient : public FrameTestHelpers::TestWebFrameClient
{ |
| 6704 public: | 6704 public: |
| 6705 ManifestChangeWebFrameClient() : m_manifestChangeCount(0) { } | 6705 ManifestChangeWebFrameClient() : m_manifestChangeCount(0) { } |
| 6706 virtual void didChangeManifest(WebLocalFrame*) override | 6706 void didChangeManifest(WebLocalFrame*) override |
| 6707 { | 6707 { |
| 6708 ++m_manifestChangeCount; | 6708 ++m_manifestChangeCount; |
| 6709 } | 6709 } |
| 6710 | 6710 |
| 6711 int manifestChangeCount() { return m_manifestChangeCount; } | 6711 int manifestChangeCount() { return m_manifestChangeCount; } |
| 6712 | 6712 |
| 6713 private: | 6713 private: |
| 6714 int m_manifestChangeCount; | 6714 int m_manifestChangeCount; |
| 6715 }; | 6715 }; |
| 6716 | 6716 |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6786 | 6786 |
| 6787 ResourcePtr<Resource> resource = fetchManifest(document, toKURL(m_notBaseURL
+ "link-manifest-fetch.json")); | 6787 ResourcePtr<Resource> resource = fetchManifest(document, toKURL(m_notBaseURL
+ "link-manifest-fetch.json")); |
| 6788 | 6788 |
| 6789 EXPECT_TRUE(resource->isLoaded()); | 6789 EXPECT_TRUE(resource->isLoaded()); |
| 6790 } | 6790 } |
| 6791 | 6791 |
| 6792 | 6792 |
| 6793 class DefaultPresentationChangeWebFrameClient : public FrameTestHelpers::TestWeb
FrameClient { | 6793 class DefaultPresentationChangeWebFrameClient : public FrameTestHelpers::TestWeb
FrameClient { |
| 6794 public: | 6794 public: |
| 6795 DefaultPresentationChangeWebFrameClient() : m_defaultPresentationChangeCount
(0) { } | 6795 DefaultPresentationChangeWebFrameClient() : m_defaultPresentationChangeCount
(0) { } |
| 6796 virtual void didChangeDefaultPresentation(WebLocalFrame*) override | 6796 void didChangeDefaultPresentation(WebLocalFrame*) override |
| 6797 { | 6797 { |
| 6798 ++m_defaultPresentationChangeCount; | 6798 ++m_defaultPresentationChangeCount; |
| 6799 } | 6799 } |
| 6800 | 6800 |
| 6801 int defaultPresentationChangeCount() { return m_defaultPresentationChangeCou
nt; } | 6801 int defaultPresentationChangeCount() { return m_defaultPresentationChangeCou
nt; } |
| 6802 | 6802 |
| 6803 private: | 6803 private: |
| 6804 int m_defaultPresentationChangeCount; | 6804 int m_defaultPresentationChangeCount; |
| 6805 }; | 6805 }; |
| 6806 | 6806 |
| (...skipping 730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7537 WebLocalFrame* childFrame = view->mainFrame()->toWebRemoteFrame()->createLoc
alChild(WebTreeScopeType::Document, "", WebSandboxFlags::None, &childFrameClient
, nullptr); | 7537 WebLocalFrame* childFrame = view->mainFrame()->toWebRemoteFrame()->createLoc
alChild(WebTreeScopeType::Document, "", WebSandboxFlags::None, &childFrameClient
, nullptr); |
| 7538 registerMockedHttpURLLoad("foo.html"); | 7538 registerMockedHttpURLLoad("foo.html"); |
| 7539 FrameTestHelpers::loadFrame(childFrame, m_baseURL + "foo.html"); | 7539 FrameTestHelpers::loadFrame(childFrame, m_baseURL + "foo.html"); |
| 7540 EXPECT_EQ(WebInitialCommitInChildFrame, childFrameClient.historyCommitType()
); | 7540 EXPECT_EQ(WebInitialCommitInChildFrame, childFrameClient.historyCommitType()
); |
| 7541 view->close(); | 7541 view->close(); |
| 7542 } | 7542 } |
| 7543 | 7543 |
| 7544 class MockDocumentThreadableLoaderClient : public DocumentThreadableLoaderClient
{ | 7544 class MockDocumentThreadableLoaderClient : public DocumentThreadableLoaderClient
{ |
| 7545 public: | 7545 public: |
| 7546 MockDocumentThreadableLoaderClient() : m_failed(false) { } | 7546 MockDocumentThreadableLoaderClient() : m_failed(false) { } |
| 7547 virtual void didFail(const ResourceError&) override { m_failed = true;} | 7547 void didFail(const ResourceError&) override { m_failed = true;} |
| 7548 | 7548 |
| 7549 void reset() { m_failed = false; } | 7549 void reset() { m_failed = false; } |
| 7550 bool failed() { return m_failed; } | 7550 bool failed() { return m_failed; } |
| 7551 | 7551 |
| 7552 bool m_failed; | 7552 bool m_failed; |
| 7553 }; | 7553 }; |
| 7554 | 7554 |
| 7555 // FIXME: This would be better as a unittest on DocumentThreadableLoader but it | 7555 // FIXME: This would be better as a unittest on DocumentThreadableLoader but it |
| 7556 // requires spin-up of a frame. It may be possible to remove that requirement | 7556 // requires spin-up of a frame. It may be possible to remove that requirement |
| 7557 // and convert it to a unittest. | 7557 // and convert it to a unittest. |
| (...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7954 | 7954 |
| 7955 TEST_F(WebFrameTest, MaxFramesDetach) | 7955 TEST_F(WebFrameTest, MaxFramesDetach) |
| 7956 { | 7956 { |
| 7957 registerMockedHttpURLLoad("max-frames-detach.html"); | 7957 registerMockedHttpURLLoad("max-frames-detach.html"); |
| 7958 FrameTestHelpers::WebViewHelper webViewHelper; | 7958 FrameTestHelpers::WebViewHelper webViewHelper; |
| 7959 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(m_baseURL + "max-
frames-detach.html", true); | 7959 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(m_baseURL + "max-
frames-detach.html", true); |
| 7960 webViewImpl->mainFrameImpl()->collectGarbage(); | 7960 webViewImpl->mainFrameImpl()->collectGarbage(); |
| 7961 } | 7961 } |
| 7962 | 7962 |
| 7963 } // namespace blink | 7963 } // namespace blink |
| OLD | NEW |