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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 EXPECT_FLOAT_EQ((expected).x(), (actual).x()); \ | 140 EXPECT_FLOAT_EQ((expected).x(), (actual).x()); \ |
141 EXPECT_FLOAT_EQ((expected).y(), (actual).y()); \ | 141 EXPECT_FLOAT_EQ((expected).y(), (actual).y()); \ |
142 } while (false) | 142 } while (false) |
143 | 143 |
144 #define EXPECT_EQ_POINT(a, b) \ | 144 #define EXPECT_EQ_POINT(a, b) \ |
145 EXPECT_EQ(a.x(), b.x()); \ | 145 EXPECT_EQ(a.x(), b.x()); \ |
146 EXPECT_EQ(a.y(), b.y()); | 146 EXPECT_EQ(a.y(), b.y()); |
147 | 147 |
148 class FakeCompositingWebViewClient : public FrameTestHelpers::TestWebViewClient
{ | 148 class FakeCompositingWebViewClient : public FrameTestHelpers::TestWebViewClient
{ |
149 public: | 149 public: |
150 virtual bool enterFullScreen() OVERRIDE { return true; } | 150 virtual bool enterFullScreen() override { return true; } |
151 }; | 151 }; |
152 | 152 |
153 class WebFrameTest : public testing::Test { | 153 class WebFrameTest : public testing::Test { |
154 protected: | 154 protected: |
155 WebFrameTest() | 155 WebFrameTest() |
156 : m_baseURL("http://www.test.com/") | 156 : m_baseURL("http://www.test.com/") |
157 , m_notBaseURL("http://www.nottest.com/") | 157 , m_notBaseURL("http://www.nottest.com/") |
158 , m_chromeURL("chrome://") | 158 , m_chromeURL("chrome://") |
159 { | 159 { |
160 } | 160 } |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 | 382 |
383 FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), "javascrip
t:document.body.textContent = location.href; void 0;"); | 383 FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), "javascrip
t:document.body.textContent = location.href; void 0;"); |
384 | 384 |
385 std::string content = webViewHelper.webView()->mainFrame()->contentAsText(10
24).utf8(); | 385 std::string content = webViewHelper.webView()->mainFrame()->contentAsText(10
24).utf8(); |
386 EXPECT_EQ("http://www.test.com:0/" + fileName, content); | 386 EXPECT_EQ("http://www.test.com:0/" + fileName, content); |
387 } | 387 } |
388 | 388 |
389 class CSSCallbackWebFrameClient : public FrameTestHelpers::TestWebFrameClient { | 389 class CSSCallbackWebFrameClient : public FrameTestHelpers::TestWebFrameClient { |
390 public: | 390 public: |
391 CSSCallbackWebFrameClient() : m_updateCount(0) { } | 391 CSSCallbackWebFrameClient() : m_updateCount(0) { } |
392 virtual void didMatchCSS(WebLocalFrame*, const WebVector<WebString>& newlyMa
tchingSelectors, const WebVector<WebString>& stoppedMatchingSelectors) OVERRIDE; | 392 virtual void didMatchCSS(WebLocalFrame*, const WebVector<WebString>& newlyMa
tchingSelectors, const WebVector<WebString>& stoppedMatchingSelectors) override; |
393 | 393 |
394 std::map<WebLocalFrame*, std::set<std::string> > m_matchedSelectors; | 394 std::map<WebLocalFrame*, std::set<std::string> > m_matchedSelectors; |
395 int m_updateCount; | 395 int m_updateCount; |
396 }; | 396 }; |
397 | 397 |
398 void CSSCallbackWebFrameClient::didMatchCSS(WebLocalFrame* frame, const WebVecto
r<WebString>& newlyMatchingSelectors, const WebVector<WebString>& stoppedMatchin
gSelectors) | 398 void CSSCallbackWebFrameClient::didMatchCSS(WebLocalFrame* frame, const WebVecto
r<WebString>& newlyMatchingSelectors, const WebVector<WebString>& stoppedMatchin
gSelectors) |
399 { | 399 { |
400 ++m_updateCount; | 400 ++m_updateCount; |
401 std::set<std::string>& frameSelectors = m_matchedSelectors[frame]; | 401 std::set<std::string>& frameSelectors = m_matchedSelectors[frame]; |
402 for (size_t i = 0; i < newlyMatchingSelectors.size(); ++i) { | 402 for (size_t i = 0; i < newlyMatchingSelectors.size(); ++i) { |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
693 frame->domWindow()->postMessage(SerializedScriptValue::create("message"), 0,
"*", frame->domWindow(), exceptionState); | 693 frame->domWindow()->postMessage(SerializedScriptValue::create("message"), 0,
"*", frame->domWindow(), exceptionState); |
694 webViewHelper.reset(); | 694 webViewHelper.reset(); |
695 EXPECT_FALSE(exceptionState.hadException()); | 695 EXPECT_FALSE(exceptionState.hadException()); |
696 | 696 |
697 // Success is not crashing. | 697 // Success is not crashing. |
698 runPendingTasks(); | 698 runPendingTasks(); |
699 } | 699 } |
700 | 700 |
701 class FixedLayoutTestWebViewClient : public FrameTestHelpers::TestWebViewClient
{ | 701 class FixedLayoutTestWebViewClient : public FrameTestHelpers::TestWebViewClient
{ |
702 public: | 702 public: |
703 virtual WebScreenInfo screenInfo() OVERRIDE { return m_screenInfo; } | 703 virtual WebScreenInfo screenInfo() override { return m_screenInfo; } |
704 | 704 |
705 WebScreenInfo m_screenInfo; | 705 WebScreenInfo m_screenInfo; |
706 }; | 706 }; |
707 | 707 |
708 // Viewport settings need to be set before the page gets loaded | 708 // Viewport settings need to be set before the page gets loaded |
709 static void enableViewportSettings(WebSettings* settings) | 709 static void enableViewportSettings(WebSettings* settings) |
710 { | 710 { |
711 settings->setViewportMetaEnabled(true); | 711 settings->setViewportMetaEnabled(true); |
712 settings->setViewportEnabled(true); | 712 settings->setViewportEnabled(true); |
713 settings->setMainFrameResizesAreOrientationChanges(true); | 713 settings->setMainFrameResizesAreOrientationChanges(true); |
(...skipping 2268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2982 // Horizontal scroll have to be the same | 2982 // Horizontal scroll have to be the same |
2983 EXPECT_NEAR(hScroll, scroll.x(), 1); | 2983 EXPECT_NEAR(hScroll, scroll.x(), 1); |
2984 vScroll = editBoxWithText.y - (viewportHeight / scale - editBoxWithText.heig
ht) / 2; | 2984 vScroll = editBoxWithText.y - (viewportHeight / scale - editBoxWithText.heig
ht) / 2; |
2985 EXPECT_NEAR(vScroll, scroll.y(), 1); | 2985 EXPECT_NEAR(vScroll, scroll.y(), 1); |
2986 // Page scale have to be unchanged | 2986 // Page scale have to be unchanged |
2987 EXPECT_EQ(newScale, scale); | 2987 EXPECT_EQ(newScale, scale); |
2988 } | 2988 } |
2989 | 2989 |
2990 class TestReloadDoesntRedirectWebFrameClient : public FrameTestHelpers::TestWebF
rameClient { | 2990 class TestReloadDoesntRedirectWebFrameClient : public FrameTestHelpers::TestWebF
rameClient { |
2991 public: | 2991 public: |
2992 virtual WebNavigationPolicy decidePolicyForNavigation(const NavigationPolicy
Info& info) OVERRIDE | 2992 virtual WebNavigationPolicy decidePolicyForNavigation(const NavigationPolicy
Info& info) override |
2993 { | 2993 { |
2994 EXPECT_FALSE(info.isRedirect); | 2994 EXPECT_FALSE(info.isRedirect); |
2995 return WebNavigationPolicyCurrentTab; | 2995 return WebNavigationPolicyCurrentTab; |
2996 } | 2996 } |
2997 }; | 2997 }; |
2998 | 2998 |
2999 TEST_F(WebFrameTest, ReloadDoesntSetRedirect) | 2999 TEST_F(WebFrameTest, ReloadDoesntSetRedirect) |
3000 { | 3000 { |
3001 // Test for case in http://crbug.com/73104. Reloading a frame very quickly | 3001 // Test for case in http://crbug.com/73104. Reloading a frame very quickly |
3002 // would sometimes call decidePolicyForNavigation with isRedirect=true | 3002 // would sometimes call decidePolicyForNavigation with isRedirect=true |
3003 registerMockedHttpURLLoad("form.html"); | 3003 registerMockedHttpURLLoad("form.html"); |
3004 | 3004 |
3005 TestReloadDoesntRedirectWebFrameClient webFrameClient; | 3005 TestReloadDoesntRedirectWebFrameClient webFrameClient; |
3006 FrameTestHelpers::WebViewHelper webViewHelper; | 3006 FrameTestHelpers::WebViewHelper webViewHelper; |
3007 webViewHelper.initializeAndLoad(m_baseURL + "form.html", false, &webFrameCli
ent); | 3007 webViewHelper.initializeAndLoad(m_baseURL + "form.html", false, &webFrameCli
ent); |
3008 | 3008 |
3009 webViewHelper.webView()->mainFrame()->reload(true); | 3009 webViewHelper.webView()->mainFrame()->reload(true); |
3010 // start another reload before request is delivered. | 3010 // start another reload before request is delivered. |
3011 FrameTestHelpers::reloadFrameIgnoringCache(webViewHelper.webView()->mainFram
e()); | 3011 FrameTestHelpers::reloadFrameIgnoringCache(webViewHelper.webView()->mainFram
e()); |
3012 } | 3012 } |
3013 | 3013 |
3014 class ReloadWithOverrideURLTask : public WebThread::Task { | 3014 class ReloadWithOverrideURLTask : public WebThread::Task { |
3015 public: | 3015 public: |
3016 ReloadWithOverrideURLTask(WebFrame* frame, const KURL& url, bool ignoreCache
) | 3016 ReloadWithOverrideURLTask(WebFrame* frame, const KURL& url, bool ignoreCache
) |
3017 : m_frame(frame), m_url(url), m_ignoreCache(ignoreCache) | 3017 : m_frame(frame), m_url(url), m_ignoreCache(ignoreCache) |
3018 { | 3018 { |
3019 } | 3019 } |
3020 | 3020 |
3021 virtual void run() OVERRIDE | 3021 virtual void run() override |
3022 { | 3022 { |
3023 m_frame->reloadWithOverrideURL(m_url, m_ignoreCache); | 3023 m_frame->reloadWithOverrideURL(m_url, m_ignoreCache); |
3024 } | 3024 } |
3025 | 3025 |
3026 private: | 3026 private: |
3027 WebFrame* const m_frame; | 3027 WebFrame* const m_frame; |
3028 const KURL m_url; | 3028 const KURL m_url; |
3029 const bool m_ignoreCache; | 3029 const bool m_ignoreCache; |
3030 }; | 3030 }; |
3031 | 3031 |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3183 delete releaseNotifications[i]; | 3183 delete releaseNotifications[i]; |
3184 | 3184 |
3185 createNotifications.clear(); | 3185 createNotifications.clear(); |
3186 releaseNotifications.clear(); | 3186 releaseNotifications.clear(); |
3187 } | 3187 } |
3188 | 3188 |
3189 std::vector<Notification*> createNotifications; | 3189 std::vector<Notification*> createNotifications; |
3190 std::vector<Notification*> releaseNotifications; | 3190 std::vector<Notification*> releaseNotifications; |
3191 | 3191 |
3192 private: | 3192 private: |
3193 virtual void didCreateScriptContext(WebLocalFrame* frame, v8::Handle<v8::Con
text> context, int extensionGroup, int worldId) OVERRIDE | 3193 virtual void didCreateScriptContext(WebLocalFrame* frame, v8::Handle<v8::Con
text> context, int extensionGroup, int worldId) override |
3194 { | 3194 { |
3195 createNotifications.push_back(new Notification(frame, context, worldId))
; | 3195 createNotifications.push_back(new Notification(frame, context, worldId))
; |
3196 } | 3196 } |
3197 | 3197 |
3198 virtual void willReleaseScriptContext(WebLocalFrame* frame, v8::Handle<v8::C
ontext> context, int worldId) OVERRIDE | 3198 virtual void willReleaseScriptContext(WebLocalFrame* frame, v8::Handle<v8::C
ontext> context, int worldId) override |
3199 { | 3199 { |
3200 releaseNotifications.push_back(new Notification(frame, context, worldId)
); | 3200 releaseNotifications.push_back(new Notification(frame, context, worldId)
); |
3201 } | 3201 } |
3202 }; | 3202 }; |
3203 | 3203 |
3204 // TODO(aa): Deflake this test. | 3204 // TODO(aa): Deflake this test. |
3205 TEST_F(WebFrameTest, FLAKY_ContextNotificationsLoadUnload) | 3205 TEST_F(WebFrameTest, FLAKY_ContextNotificationsLoadUnload) |
3206 { | 3206 { |
3207 v8::HandleScope handleScope(v8::Isolate::GetCurrent()); | 3207 v8::HandleScope handleScope(v8::Isolate::GetCurrent()); |
3208 | 3208 |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3451 frame->executeCommand(WebString::fromUTF8("SelectAll")); | 3451 frame->executeCommand(WebString::fromUTF8("SelectAll")); |
3452 EXPECT_TRUE(frame->hasSelection()); | 3452 EXPECT_TRUE(frame->hasSelection()); |
3453 frame->executeCommand(WebString::fromUTF8("Unselect")); | 3453 frame->executeCommand(WebString::fromUTF8("Unselect")); |
3454 EXPECT_FALSE(frame->hasSelection()); | 3454 EXPECT_FALSE(frame->hasSelection()); |
3455 WebString selectionHtml = frame->selectionAsMarkup(); | 3455 WebString selectionHtml = frame->selectionAsMarkup(); |
3456 EXPECT_TRUE(selectionHtml.isEmpty()); | 3456 EXPECT_TRUE(selectionHtml.isEmpty()); |
3457 } | 3457 } |
3458 | 3458 |
3459 class TestExecuteScriptDuringDidCreateScriptContext : public FrameTestHelpers::T
estWebFrameClient { | 3459 class TestExecuteScriptDuringDidCreateScriptContext : public FrameTestHelpers::T
estWebFrameClient { |
3460 public: | 3460 public: |
3461 virtual void didCreateScriptContext(WebLocalFrame* frame, v8::Handle<v8::Con
text> context, int extensionGroup, int worldId) OVERRIDE | 3461 virtual void didCreateScriptContext(WebLocalFrame* frame, v8::Handle<v8::Con
text> context, int extensionGroup, int worldId) override |
3462 { | 3462 { |
3463 frame->executeScript(WebScriptSource("window.history = 'replaced';")); | 3463 frame->executeScript(WebScriptSource("window.history = 'replaced';")); |
3464 } | 3464 } |
3465 }; | 3465 }; |
3466 | 3466 |
3467 TEST_F(WebFrameTest, ExecuteScriptDuringDidCreateScriptContext) | 3467 TEST_F(WebFrameTest, ExecuteScriptDuringDidCreateScriptContext) |
3468 { | 3468 { |
3469 registerMockedHttpURLLoad("hello_world.html"); | 3469 registerMockedHttpURLLoad("hello_world.html"); |
3470 | 3470 |
3471 TestExecuteScriptDuringDidCreateScriptContext webFrameClient; | 3471 TestExecuteScriptDuringDidCreateScriptContext webFrameClient; |
3472 FrameTestHelpers::WebViewHelper webViewHelper; | 3472 FrameTestHelpers::WebViewHelper webViewHelper; |
3473 webViewHelper.initializeAndLoad(m_baseURL + "hello_world.html", true, &webFr
ameClient); | 3473 webViewHelper.initializeAndLoad(m_baseURL + "hello_world.html", true, &webFr
ameClient); |
3474 | 3474 |
3475 FrameTestHelpers::reloadFrame(webViewHelper.webView()->mainFrame()); | 3475 FrameTestHelpers::reloadFrame(webViewHelper.webView()->mainFrame()); |
3476 } | 3476 } |
3477 | 3477 |
3478 class FindUpdateWebFrameClient : public FrameTestHelpers::TestWebFrameClient { | 3478 class FindUpdateWebFrameClient : public FrameTestHelpers::TestWebFrameClient { |
3479 public: | 3479 public: |
3480 FindUpdateWebFrameClient() | 3480 FindUpdateWebFrameClient() |
3481 : m_findResultsAreReady(false) | 3481 : m_findResultsAreReady(false) |
3482 , m_count(-1) | 3482 , m_count(-1) |
3483 { | 3483 { |
3484 } | 3484 } |
3485 | 3485 |
3486 virtual void reportFindInPageMatchCount(int, int count, bool finalUpdate) OV
ERRIDE | 3486 virtual void reportFindInPageMatchCount(int, int count, bool finalUpdate) ov
erride |
3487 { | 3487 { |
3488 m_count = count; | 3488 m_count = count; |
3489 if (finalUpdate) | 3489 if (finalUpdate) |
3490 m_findResultsAreReady = true; | 3490 m_findResultsAreReady = true; |
3491 } | 3491 } |
3492 | 3492 |
3493 bool findResultsAreReady() const { return m_findResultsAreReady; } | 3493 bool findResultsAreReady() const { return m_findResultsAreReady; } |
3494 int count() const { return m_count; } | 3494 int count() const { return m_count; } |
3495 | 3495 |
3496 private: | 3496 private: |
(...skipping 697 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4194 EXPECT_EQ(startRect, initialStartRect); | 4194 EXPECT_EQ(startRect, initialStartRect); |
4195 EXPECT_EQ(endRect, initialEndRect); | 4195 EXPECT_EQ(endRect, initialEndRect); |
4196 } | 4196 } |
4197 #endif | 4197 #endif |
4198 | 4198 |
4199 class CompositedSelectionBoundsTestLayerTreeView : public WebLayerTreeView { | 4199 class CompositedSelectionBoundsTestLayerTreeView : public WebLayerTreeView { |
4200 public: | 4200 public: |
4201 CompositedSelectionBoundsTestLayerTreeView() : m_selectionCleared(false) { } | 4201 CompositedSelectionBoundsTestLayerTreeView() : m_selectionCleared(false) { } |
4202 virtual ~CompositedSelectionBoundsTestLayerTreeView() { } | 4202 virtual ~CompositedSelectionBoundsTestLayerTreeView() { } |
4203 | 4203 |
4204 virtual void setSurfaceReady() OVERRIDE { } | 4204 virtual void setSurfaceReady() override { } |
4205 virtual void setRootLayer(const WebLayer&) OVERRIDE { } | 4205 virtual void setRootLayer(const WebLayer&) override { } |
4206 virtual void clearRootLayer() OVERRIDE { } | 4206 virtual void clearRootLayer() override { } |
4207 virtual void setViewportSize(const WebSize& deviceViewportSize) OVERRIDE {
} | 4207 virtual void setViewportSize(const WebSize& deviceViewportSize) override {
} |
4208 virtual WebSize deviceViewportSize() const OVERRIDE { return WebSize(); } | 4208 virtual WebSize deviceViewportSize() const override { return WebSize(); } |
4209 virtual void setDeviceScaleFactor(float) OVERRIDE { } | 4209 virtual void setDeviceScaleFactor(float) override { } |
4210 virtual float deviceScaleFactor() const OVERRIDE { return 1.f; } | 4210 virtual float deviceScaleFactor() const override { return 1.f; } |
4211 virtual void setBackgroundColor(WebColor) OVERRIDE { } | 4211 virtual void setBackgroundColor(WebColor) override { } |
4212 virtual void setHasTransparentBackground(bool) OVERRIDE { } | 4212 virtual void setHasTransparentBackground(bool) override { } |
4213 virtual void setVisible(bool) OVERRIDE { } | 4213 virtual void setVisible(bool) override { } |
4214 virtual void setPageScaleFactorAndLimits(float pageScaleFactor, float minimu
m, float maximum) OVERRIDE { } | 4214 virtual void setPageScaleFactorAndLimits(float pageScaleFactor, float minimu
m, float maximum) override { } |
4215 virtual void startPageScaleAnimation(const WebPoint& destination, bool useAn
chor, float newPageScale, double durationSec) OVERRIDE { } | 4215 virtual void startPageScaleAnimation(const WebPoint& destination, bool useAn
chor, float newPageScale, double durationSec) override { } |
4216 virtual void setNeedsAnimate() OVERRIDE { } | 4216 virtual void setNeedsAnimate() override { } |
4217 virtual bool commitRequested() const OVERRIDE { return false; } | 4217 virtual bool commitRequested() const override { return false; } |
4218 virtual void finishAllRendering() OVERRIDE { } | 4218 virtual void finishAllRendering() override { } |
4219 virtual void registerSelection(const WebSelectionBound& start, const WebSele
ctionBound& end) OVERRIDE | 4219 virtual void registerSelection(const WebSelectionBound& start, const WebSele
ctionBound& end) override |
4220 { | 4220 { |
4221 m_start = adoptPtr(new WebSelectionBound(start)); | 4221 m_start = adoptPtr(new WebSelectionBound(start)); |
4222 m_end = adoptPtr(new WebSelectionBound(end)); | 4222 m_end = adoptPtr(new WebSelectionBound(end)); |
4223 } | 4223 } |
4224 virtual void clearSelection() OVERRIDE | 4224 virtual void clearSelection() override |
4225 { | 4225 { |
4226 m_selectionCleared = true; | 4226 m_selectionCleared = true; |
4227 m_start.clear(); | 4227 m_start.clear(); |
4228 m_end.clear(); | 4228 m_end.clear(); |
4229 } | 4229 } |
4230 | 4230 |
4231 bool getAndResetSelectionCleared() | 4231 bool getAndResetSelectionCleared() |
4232 { | 4232 { |
4233 bool selectionCleared = m_selectionCleared; | 4233 bool selectionCleared = m_selectionCleared; |
4234 m_selectionCleared = false; | 4234 m_selectionCleared = false; |
4235 return selectionCleared; | 4235 return selectionCleared; |
4236 } | 4236 } |
4237 | 4237 |
4238 const WebSelectionBound* start() const { return m_start.get(); } | 4238 const WebSelectionBound* start() const { return m_start.get(); } |
4239 const WebSelectionBound* end() const { return m_end.get(); } | 4239 const WebSelectionBound* end() const { return m_end.get(); } |
4240 | 4240 |
4241 private: | 4241 private: |
4242 bool m_selectionCleared; | 4242 bool m_selectionCleared; |
4243 OwnPtr<WebSelectionBound> m_start; | 4243 OwnPtr<WebSelectionBound> m_start; |
4244 OwnPtr<WebSelectionBound> m_end; | 4244 OwnPtr<WebSelectionBound> m_end; |
4245 }; | 4245 }; |
4246 | 4246 |
4247 class CompositedSelectionBoundsTestWebViewClient : public FrameTestHelpers::Test
WebViewClient { | 4247 class CompositedSelectionBoundsTestWebViewClient : public FrameTestHelpers::Test
WebViewClient { |
4248 public: | 4248 public: |
4249 virtual ~CompositedSelectionBoundsTestWebViewClient() { } | 4249 virtual ~CompositedSelectionBoundsTestWebViewClient() { } |
4250 virtual WebLayerTreeView* layerTreeView() OVERRIDE { return &m_testLayerTree
View; } | 4250 virtual WebLayerTreeView* layerTreeView() override { return &m_testLayerTree
View; } |
4251 | 4251 |
4252 CompositedSelectionBoundsTestLayerTreeView& selectionLayerTreeView() { retur
n m_testLayerTreeView; } | 4252 CompositedSelectionBoundsTestLayerTreeView& selectionLayerTreeView() { retur
n m_testLayerTreeView; } |
4253 | 4253 |
4254 private: | 4254 private: |
4255 CompositedSelectionBoundsTestLayerTreeView m_testLayerTreeView; | 4255 CompositedSelectionBoundsTestLayerTreeView m_testLayerTreeView; |
4256 }; | 4256 }; |
4257 | 4257 |
4258 class CompositedSelectionBoundsTest : public WebFrameTest { | 4258 class CompositedSelectionBoundsTest : public WebFrameTest { |
4259 protected: | 4259 protected: |
4260 CompositedSelectionBoundsTest() | 4260 CompositedSelectionBoundsTest() |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4386 | 4386 |
4387 frame = webViewHelper.webView()->mainFrame(); | 4387 frame = webViewHelper.webView()->mainFrame(); |
4388 frame->executeCommand(WebString::fromUTF8("Unselect")); | 4388 frame->executeCommand(WebString::fromUTF8("Unselect")); |
4389 webViewHelper.webView()->layout(); | 4389 webViewHelper.webView()->layout(); |
4390 ASSERT_FALSE(frame->hasSelection()); | 4390 ASSERT_FALSE(frame->hasSelection()); |
4391 EXPECT_TRUE(fakeSelectionLayerTreeView.getAndResetSelectionCleared()); | 4391 EXPECT_TRUE(fakeSelectionLayerTreeView.getAndResetSelectionCleared()); |
4392 } | 4392 } |
4393 | 4393 |
4394 class DisambiguationPopupTestWebViewClient : public FrameTestHelpers::TestWebVie
wClient { | 4394 class DisambiguationPopupTestWebViewClient : public FrameTestHelpers::TestWebVie
wClient { |
4395 public: | 4395 public: |
4396 virtual bool didTapMultipleTargets(const WebSize&, const WebRect&, const Web
Vector<WebRect>& targetRects) OVERRIDE | 4396 virtual bool didTapMultipleTargets(const WebSize&, const WebRect&, const Web
Vector<WebRect>& targetRects) override |
4397 { | 4397 { |
4398 EXPECT_GE(targetRects.size(), 2u); | 4398 EXPECT_GE(targetRects.size(), 2u); |
4399 m_triggered = true; | 4399 m_triggered = true; |
4400 return true; | 4400 return true; |
4401 } | 4401 } |
4402 | 4402 |
4403 bool triggered() const { return m_triggered; } | 4403 bool triggered() const { return m_triggered; } |
4404 void resetTriggered() { m_triggered = false; } | 4404 void resetTriggered() { m_triggered = false; } |
4405 bool m_triggered; | 4405 bool m_triggered; |
4406 }; | 4406 }; |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4724 EXPECT_EQ("This should appear", text.utf8()); | 4724 EXPECT_EQ("This should appear", text.utf8()); |
4725 EXPECT_TRUE(webFrameClient.commitCalled()); | 4725 EXPECT_TRUE(webFrameClient.commitCalled()); |
4726 } | 4726 } |
4727 | 4727 |
4728 class TestWillInsertBodyWebFrameClient : public FrameTestHelpers::TestWebFrameCl
ient { | 4728 class TestWillInsertBodyWebFrameClient : public FrameTestHelpers::TestWebFrameCl
ient { |
4729 public: | 4729 public: |
4730 TestWillInsertBodyWebFrameClient() : m_numBodies(0), m_didLoad(false) | 4730 TestWillInsertBodyWebFrameClient() : m_numBodies(0), m_didLoad(false) |
4731 { | 4731 { |
4732 } | 4732 } |
4733 | 4733 |
4734 virtual void didCommitProvisionalLoad(WebLocalFrame*, const WebHistoryItem&,
WebHistoryCommitType) OVERRIDE | 4734 virtual void didCommitProvisionalLoad(WebLocalFrame*, const WebHistoryItem&,
WebHistoryCommitType) override |
4735 { | 4735 { |
4736 m_numBodies = 0; | 4736 m_numBodies = 0; |
4737 m_didLoad = true; | 4737 m_didLoad = true; |
4738 } | 4738 } |
4739 | 4739 |
4740 virtual void didCreateDocumentElement(WebLocalFrame*) OVERRIDE | 4740 virtual void didCreateDocumentElement(WebLocalFrame*) override |
4741 { | 4741 { |
4742 EXPECT_EQ(0, m_numBodies); | 4742 EXPECT_EQ(0, m_numBodies); |
4743 } | 4743 } |
4744 | 4744 |
4745 virtual void willInsertBody(WebLocalFrame*) OVERRIDE | 4745 virtual void willInsertBody(WebLocalFrame*) override |
4746 { | 4746 { |
4747 m_numBodies++; | 4747 m_numBodies++; |
4748 } | 4748 } |
4749 | 4749 |
4750 int m_numBodies; | 4750 int m_numBodies; |
4751 bool m_didLoad; | 4751 bool m_didLoad; |
4752 }; | 4752 }; |
4753 | 4753 |
4754 TEST_F(WebFrameTest, HTMLDocument) | 4754 TEST_F(WebFrameTest, HTMLDocument) |
4755 { | 4755 { |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4803 EXPECT_FALSE(transitionElement.isNull()); | 4803 EXPECT_FALSE(transitionElement.isNull()); |
4804 | 4804 |
4805 // Check that the inline script was not executed. | 4805 // Check that the inline script was not executed. |
4806 EXPECT_FALSE(transitionElement.hasAttribute("dir")); | 4806 EXPECT_FALSE(transitionElement.hasAttribute("dir")); |
4807 } | 4807 } |
4808 | 4808 |
4809 class SpellCheckClient : public WebSpellCheckClient { | 4809 class SpellCheckClient : public WebSpellCheckClient { |
4810 public: | 4810 public: |
4811 explicit SpellCheckClient(uint32_t hash = 0) : m_numberOfTimesChecked(0), m_
hash(hash) { } | 4811 explicit SpellCheckClient(uint32_t hash = 0) : m_numberOfTimesChecked(0), m_
hash(hash) { } |
4812 virtual ~SpellCheckClient() { } | 4812 virtual ~SpellCheckClient() { } |
4813 virtual void requestCheckingOfText(const WebString&, const WebVector<uint32_
t>&, const WebVector<unsigned>&, WebTextCheckingCompletion* completion) OVERRIDE | 4813 virtual void requestCheckingOfText(const WebString&, const WebVector<uint32_
t>&, const WebVector<unsigned>&, WebTextCheckingCompletion* completion) override |
4814 { | 4814 { |
4815 ++m_numberOfTimesChecked; | 4815 ++m_numberOfTimesChecked; |
4816 Vector<WebTextCheckingResult> results; | 4816 Vector<WebTextCheckingResult> results; |
4817 const int misspellingStartOffset = 1; | 4817 const int misspellingStartOffset = 1; |
4818 const int misspellingLength = 8; | 4818 const int misspellingLength = 8; |
4819 results.append(WebTextCheckingResult(WebTextDecorationTypeSpelling, miss
pellingStartOffset, misspellingLength, WebString(), m_hash)); | 4819 results.append(WebTextCheckingResult(WebTextDecorationTypeSpelling, miss
pellingStartOffset, misspellingLength, WebString(), m_hash)); |
4820 completion->didFinishCheckingText(results); | 4820 completion->didFinishCheckingText(results); |
4821 } | 4821 } |
4822 int numberOfTimesChecked() const { return m_numberOfTimesChecked; } | 4822 int numberOfTimesChecked() const { return m_numberOfTimesChecked; } |
4823 private: | 4823 private: |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4945 | 4945 |
4946 class StubbornSpellCheckClient : public WebSpellCheckClient { | 4946 class StubbornSpellCheckClient : public WebSpellCheckClient { |
4947 public: | 4947 public: |
4948 StubbornSpellCheckClient() : m_completion(0) { } | 4948 StubbornSpellCheckClient() : m_completion(0) { } |
4949 virtual ~StubbornSpellCheckClient() { } | 4949 virtual ~StubbornSpellCheckClient() { } |
4950 | 4950 |
4951 virtual void requestCheckingOfText( | 4951 virtual void requestCheckingOfText( |
4952 const WebString&, | 4952 const WebString&, |
4953 const WebVector<uint32_t>&, | 4953 const WebVector<uint32_t>&, |
4954 const WebVector<unsigned>&, | 4954 const WebVector<unsigned>&, |
4955 WebTextCheckingCompletion* completion) OVERRIDE | 4955 WebTextCheckingCompletion* completion) override |
4956 { | 4956 { |
4957 m_completion = completion; | 4957 m_completion = completion; |
4958 } | 4958 } |
4959 | 4959 |
4960 void kickNoResults() | 4960 void kickNoResults() |
4961 { | 4961 { |
4962 kick(-1, -1, WebTextDecorationTypeSpelling); | 4962 kick(-1, -1, WebTextDecorationTypeSpelling); |
4963 } | 4963 } |
4964 | 4964 |
4965 void kick() | 4965 void kick() |
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5286 TestMainFrameUserOrProgrammaticScrollFrameClient() { reset(); } | 5286 TestMainFrameUserOrProgrammaticScrollFrameClient() { reset(); } |
5287 void reset() | 5287 void reset() |
5288 { | 5288 { |
5289 m_didScrollMainFrame = false; | 5289 m_didScrollMainFrame = false; |
5290 m_wasProgrammaticScroll = false; | 5290 m_wasProgrammaticScroll = false; |
5291 } | 5291 } |
5292 bool wasUserScroll() const { return m_didScrollMainFrame && !m_wasProgrammat
icScroll; } | 5292 bool wasUserScroll() const { return m_didScrollMainFrame && !m_wasProgrammat
icScroll; } |
5293 bool wasProgrammaticScroll() const { return m_didScrollMainFrame && m_wasPro
grammaticScroll; } | 5293 bool wasProgrammaticScroll() const { return m_didScrollMainFrame && m_wasPro
grammaticScroll; } |
5294 | 5294 |
5295 // WebFrameClient: | 5295 // WebFrameClient: |
5296 virtual void didChangeScrollOffset(WebLocalFrame* frame) OVERRIDE | 5296 virtual void didChangeScrollOffset(WebLocalFrame* frame) override |
5297 { | 5297 { |
5298 if (frame->parent()) | 5298 if (frame->parent()) |
5299 return; | 5299 return; |
5300 EXPECT_FALSE(m_didScrollMainFrame); | 5300 EXPECT_FALSE(m_didScrollMainFrame); |
5301 FrameView* view = toWebLocalFrameImpl(frame)->frameView(); | 5301 FrameView* view = toWebLocalFrameImpl(frame)->frameView(); |
5302 // FrameView can be scrolled in FrameView::setFixedVisibleContentRect | 5302 // FrameView can be scrolled in FrameView::setFixedVisibleContentRect |
5303 // which is called from LocalFrame::createView (before the frame is asso
ciated | 5303 // which is called from LocalFrame::createView (before the frame is asso
ciated |
5304 // with the the view). | 5304 // with the the view). |
5305 if (view) { | 5305 if (view) { |
5306 m_didScrollMainFrame = true; | 5306 m_didScrollMainFrame = true; |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5409 Platform::current()->unitTestSupport()->registerMockedURL(redirectURL, final
Response, filePath); | 5409 Platform::current()->unitTestSupport()->registerMockedURL(redirectURL, final
Response, filePath); |
5410 | 5410 |
5411 FrameTestHelpers::WebViewHelper webViewHelper; | 5411 FrameTestHelpers::WebViewHelper webViewHelper; |
5412 webViewHelper.initializeAndLoad(m_baseURL + "first_party_redirect.html", tru
e); | 5412 webViewHelper.initializeAndLoad(m_baseURL + "first_party_redirect.html", tru
e); |
5413 EXPECT_TRUE(webViewHelper.webView()->mainFrame()->document().firstPartyForCo
okies() == redirectURL); | 5413 EXPECT_TRUE(webViewHelper.webView()->mainFrame()->document().firstPartyForCo
okies() == redirectURL); |
5414 } | 5414 } |
5415 | 5415 |
5416 class TestNavigationPolicyWebFrameClient : public FrameTestHelpers::TestWebFrame
Client { | 5416 class TestNavigationPolicyWebFrameClient : public FrameTestHelpers::TestWebFrame
Client { |
5417 public: | 5417 public: |
5418 | 5418 |
5419 virtual void didNavigateWithinPage(WebLocalFrame*, const WebHistoryItem&, We
bHistoryCommitType) OVERRIDE | 5419 virtual void didNavigateWithinPage(WebLocalFrame*, const WebHistoryItem&, We
bHistoryCommitType) override |
5420 { | 5420 { |
5421 EXPECT_TRUE(false); | 5421 EXPECT_TRUE(false); |
5422 } | 5422 } |
5423 }; | 5423 }; |
5424 | 5424 |
5425 TEST_F(WebFrameTest, SimulateFragmentAnchorMiddleClick) | 5425 TEST_F(WebFrameTest, SimulateFragmentAnchorMiddleClick) |
5426 { | 5426 { |
5427 registerMockedHttpURLLoad("fragment_middle_click.html"); | 5427 registerMockedHttpURLLoad("fragment_middle_click.html"); |
5428 TestNavigationPolicyWebFrameClient client; | 5428 TestNavigationPolicyWebFrameClient client; |
5429 FrameTestHelpers::WebViewHelper webViewHelper; | 5429 FrameTestHelpers::WebViewHelper webViewHelper; |
5430 webViewHelper.initializeAndLoad(m_baseURL + "fragment_middle_click.html", tr
ue, &client); | 5430 webViewHelper.initializeAndLoad(m_baseURL + "fragment_middle_click.html", tr
ue, &client); |
5431 | 5431 |
5432 Document* document = toLocalFrame(webViewHelper.webViewImpl()->page()->mainF
rame())->document(); | 5432 Document* document = toLocalFrame(webViewHelper.webViewImpl()->page()->mainF
rame())->document(); |
5433 KURL destination = document->url(); | 5433 KURL destination = document->url(); |
5434 destination.setFragmentIdentifier("test"); | 5434 destination.setFragmentIdentifier("test"); |
5435 | 5435 |
5436 RefPtrWillBeRawPtr<Event> event = MouseEvent::create(EventTypeNames::click,
false, false, | 5436 RefPtrWillBeRawPtr<Event> event = MouseEvent::create(EventTypeNames::click,
false, false, |
5437 document->domWindow(), 0, 0, 0, 0, 0, 0, 0, false, false, false, false,
1, nullptr, nullptr); | 5437 document->domWindow(), 0, 0, 0, 0, 0, 0, 0, false, false, false, false,
1, nullptr, nullptr); |
5438 FrameLoadRequest frameRequest(document, ResourceRequest(destination)); | 5438 FrameLoadRequest frameRequest(document, ResourceRequest(destination)); |
5439 frameRequest.setTriggeringEvent(event); | 5439 frameRequest.setTriggeringEvent(event); |
5440 toLocalFrame(webViewHelper.webViewImpl()->page()->mainFrame())->loader().loa
d(frameRequest); | 5440 toLocalFrame(webViewHelper.webViewImpl()->page()->mainFrame())->loader().loa
d(frameRequest); |
5441 } | 5441 } |
5442 | 5442 |
5443 class TestNewWindowWebViewClient : public FrameTestHelpers::TestWebViewClient { | 5443 class TestNewWindowWebViewClient : public FrameTestHelpers::TestWebViewClient { |
5444 public: | 5444 public: |
5445 virtual WebView* createView(WebLocalFrame*, const WebURLRequest&, const WebW
indowFeatures&, | 5445 virtual WebView* createView(WebLocalFrame*, const WebURLRequest&, const WebW
indowFeatures&, |
5446 const WebString&, WebNavigationPolicy, bool) OVERRIDE | 5446 const WebString&, WebNavigationPolicy, bool) override |
5447 { | 5447 { |
5448 EXPECT_TRUE(false); | 5448 EXPECT_TRUE(false); |
5449 return 0; | 5449 return 0; |
5450 } | 5450 } |
5451 }; | 5451 }; |
5452 | 5452 |
5453 class TestNewWindowWebFrameClient : public FrameTestHelpers::TestWebFrameClient
{ | 5453 class TestNewWindowWebFrameClient : public FrameTestHelpers::TestWebFrameClient
{ |
5454 public: | 5454 public: |
5455 TestNewWindowWebFrameClient() | 5455 TestNewWindowWebFrameClient() |
5456 : m_decidePolicyCallCount(0) | 5456 : m_decidePolicyCallCount(0) |
5457 { | 5457 { |
5458 } | 5458 } |
5459 | 5459 |
5460 virtual WebNavigationPolicy decidePolicyForNavigation(const NavigationPolicy
Info& info) OVERRIDE | 5460 virtual WebNavigationPolicy decidePolicyForNavigation(const NavigationPolicy
Info& info) override |
5461 { | 5461 { |
5462 m_decidePolicyCallCount++; | 5462 m_decidePolicyCallCount++; |
5463 return info.defaultPolicy; | 5463 return info.defaultPolicy; |
5464 } | 5464 } |
5465 | 5465 |
5466 int decidePolicyCallCount() const { return m_decidePolicyCallCount; } | 5466 int decidePolicyCallCount() const { return m_decidePolicyCallCount; } |
5467 | 5467 |
5468 private: | 5468 private: |
5469 int m_decidePolicyCallCount; | 5469 int m_decidePolicyCallCount; |
5470 }; | 5470 }; |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5616 | 5616 |
5617 virtual void didStopLoading() | 5617 virtual void didStopLoading() |
5618 { | 5618 { |
5619 if (m_parentClient) { | 5619 if (m_parentClient) { |
5620 m_parentClient->didStopLoading(); | 5620 m_parentClient->didStopLoading(); |
5621 return; | 5621 return; |
5622 } | 5622 } |
5623 TestWebFrameClient::didStopLoading(); | 5623 TestWebFrameClient::didStopLoading(); |
5624 } | 5624 } |
5625 | 5625 |
5626 virtual void willSendRequest(WebLocalFrame* frame, unsigned, WebURLRequest&
request, const WebURLResponse&) OVERRIDE | 5626 virtual void willSendRequest(WebLocalFrame* frame, unsigned, WebURLRequest&
request, const WebURLResponse&) override |
5627 { | 5627 { |
5628 m_policy = request.cachePolicy(); | 5628 m_policy = request.cachePolicy(); |
5629 m_willSendRequestCallCount++; | 5629 m_willSendRequestCallCount++; |
5630 } | 5630 } |
5631 | 5631 |
5632 private: | 5632 private: |
5633 TestCachePolicyWebFrameClient* m_parentClient; | 5633 TestCachePolicyWebFrameClient* m_parentClient; |
5634 | 5634 |
5635 WebURLRequest::CachePolicy m_policy; | 5635 WebURLRequest::CachePolicy m_policy; |
5636 TestCachePolicyWebFrameClient* m_childClient; | 5636 TestCachePolicyWebFrameClient* m_childClient; |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5764 | 5764 |
5765 class TestStartStopCallbackWebFrameClient : public FrameTestHelpers::TestWebFram
eClient { | 5765 class TestStartStopCallbackWebFrameClient : public FrameTestHelpers::TestWebFram
eClient { |
5766 public: | 5766 public: |
5767 TestStartStopCallbackWebFrameClient() | 5767 TestStartStopCallbackWebFrameClient() |
5768 : m_startLoadingCount(0) | 5768 : m_startLoadingCount(0) |
5769 , m_stopLoadingCount(0) | 5769 , m_stopLoadingCount(0) |
5770 , m_differentDocumentStartCount(0) | 5770 , m_differentDocumentStartCount(0) |
5771 { | 5771 { |
5772 } | 5772 } |
5773 | 5773 |
5774 virtual void didStartLoading(bool toDifferentDocument) OVERRIDE | 5774 virtual void didStartLoading(bool toDifferentDocument) override |
5775 { | 5775 { |
5776 TestWebFrameClient::didStartLoading(toDifferentDocument); | 5776 TestWebFrameClient::didStartLoading(toDifferentDocument); |
5777 m_startLoadingCount++; | 5777 m_startLoadingCount++; |
5778 if (toDifferentDocument) | 5778 if (toDifferentDocument) |
5779 m_differentDocumentStartCount++; | 5779 m_differentDocumentStartCount++; |
5780 } | 5780 } |
5781 | 5781 |
5782 virtual void didStopLoading() OVERRIDE | 5782 virtual void didStopLoading() override |
5783 { | 5783 { |
5784 TestWebFrameClient::didStopLoading(); | 5784 TestWebFrameClient::didStopLoading(); |
5785 m_stopLoadingCount++; | 5785 m_stopLoadingCount++; |
5786 } | 5786 } |
5787 | 5787 |
5788 int startLoadingCount() const { return m_startLoadingCount; } | 5788 int startLoadingCount() const { return m_startLoadingCount; } |
5789 int stopLoadingCount() const { return m_stopLoadingCount; } | 5789 int stopLoadingCount() const { return m_stopLoadingCount; } |
5790 int differentDocumentStartCount() const { return m_differentDocumentStartCou
nt; } | 5790 int differentDocumentStartCount() const { return m_differentDocumentStartCou
nt; } |
5791 | 5791 |
5792 private: | 5792 private: |
(...skipping 14 matching lines...) Expand all Loading... |
5807 EXPECT_EQ(client.differentDocumentStartCount(), 1); | 5807 EXPECT_EQ(client.differentDocumentStartCount(), 1); |
5808 } | 5808 } |
5809 | 5809 |
5810 class TestDidNavigateCommitTypeWebFrameClient : public FrameTestHelpers::TestWeb
FrameClient { | 5810 class TestDidNavigateCommitTypeWebFrameClient : public FrameTestHelpers::TestWeb
FrameClient { |
5811 public: | 5811 public: |
5812 TestDidNavigateCommitTypeWebFrameClient() | 5812 TestDidNavigateCommitTypeWebFrameClient() |
5813 : m_lastCommitType(WebHistoryInertCommit) | 5813 : m_lastCommitType(WebHistoryInertCommit) |
5814 { | 5814 { |
5815 } | 5815 } |
5816 | 5816 |
5817 virtual void didNavigateWithinPage(WebLocalFrame*, const WebHistoryItem&, We
bHistoryCommitType type) OVERRIDE | 5817 virtual void didNavigateWithinPage(WebLocalFrame*, const WebHistoryItem&, We
bHistoryCommitType type) override |
5818 { | 5818 { |
5819 m_lastCommitType = type; | 5819 m_lastCommitType = type; |
5820 } | 5820 } |
5821 | 5821 |
5822 WebHistoryCommitType lastCommitType() const { return m_lastCommitType; } | 5822 WebHistoryCommitType lastCommitType() const { return m_lastCommitType; } |
5823 | 5823 |
5824 private: | 5824 private: |
5825 WebHistoryCommitType m_lastCommitType; | 5825 WebHistoryCommitType m_lastCommitType; |
5826 }; | 5826 }; |
5827 | 5827 |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5960 // After commit, there is. | 5960 // After commit, there is. |
5961 HistoryItem* item = mainFrameLoader.currentItem(); | 5961 HistoryItem* item = mainFrameLoader.currentItem(); |
5962 ASSERT_TRUE(item); | 5962 ASSERT_TRUE(item); |
5963 EXPECT_EQ(WTF::String(url.data()), item->urlString()); | 5963 EXPECT_EQ(WTF::String(url.data()), item->urlString()); |
5964 } | 5964 } |
5965 | 5965 |
5966 class FailCreateChildFrame : public FrameTestHelpers::TestWebFrameClient { | 5966 class FailCreateChildFrame : public FrameTestHelpers::TestWebFrameClient { |
5967 public: | 5967 public: |
5968 FailCreateChildFrame() : m_callCount(0) { } | 5968 FailCreateChildFrame() : m_callCount(0) { } |
5969 | 5969 |
5970 virtual WebFrame* createChildFrame(WebLocalFrame* parent, const WebString& f
rameName) OVERRIDE | 5970 virtual WebFrame* createChildFrame(WebLocalFrame* parent, const WebString& f
rameName) override |
5971 { | 5971 { |
5972 ++m_callCount; | 5972 ++m_callCount; |
5973 return 0; | 5973 return 0; |
5974 } | 5974 } |
5975 | 5975 |
5976 int callCount() const { return m_callCount; } | 5976 int callCount() const { return m_callCount; } |
5977 | 5977 |
5978 private: | 5978 private: |
5979 int m_callCount; | 5979 int m_callCount; |
5980 }; | 5980 }; |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6201 FrameTestHelpers::WebViewHelper webViewHelper; | 6201 FrameTestHelpers::WebViewHelper webViewHelper; |
6202 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(m_baseURL + "hidd
en_frames.html"); | 6202 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(m_baseURL + "hidd
en_frames.html"); |
6203 for (WebFrame* frame = webViewImpl->mainFrameImpl()->traverseNext(false); fr
ame; frame = frame->traverseNext(false)) { | 6203 for (WebFrame* frame = webViewImpl->mainFrameImpl()->traverseNext(false); fr
ame; frame = frame->traverseNext(false)) { |
6204 EXPECT_FALSE(frame->hasVisibleContent()); | 6204 EXPECT_FALSE(frame->hasVisibleContent()); |
6205 } | 6205 } |
6206 } | 6206 } |
6207 | 6207 |
6208 class ManifestChangeWebFrameClient : public FrameTestHelpers::TestWebFrameClient
{ | 6208 class ManifestChangeWebFrameClient : public FrameTestHelpers::TestWebFrameClient
{ |
6209 public: | 6209 public: |
6210 ManifestChangeWebFrameClient() : m_manifestChangeCount(0) { } | 6210 ManifestChangeWebFrameClient() : m_manifestChangeCount(0) { } |
6211 virtual void didChangeManifest(WebLocalFrame*) OVERRIDE | 6211 virtual void didChangeManifest(WebLocalFrame*) override |
6212 { | 6212 { |
6213 ++m_manifestChangeCount; | 6213 ++m_manifestChangeCount; |
6214 } | 6214 } |
6215 | 6215 |
6216 int manifestChangeCount() { return m_manifestChangeCount; } | 6216 int manifestChangeCount() { return m_manifestChangeCount; } |
6217 | 6217 |
6218 private: | 6218 private: |
6219 int m_manifestChangeCount; | 6219 int m_manifestChangeCount; |
6220 }; | 6220 }; |
6221 | 6221 |
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6601 | 6601 |
6602 // Manually reset to break WebViewHelper's dependency on the stack allocated | 6602 // Manually reset to break WebViewHelper's dependency on the stack allocated |
6603 // TestWebFrameClient. | 6603 // TestWebFrameClient. |
6604 reset(); | 6604 reset(); |
6605 remoteFrame->close(); | 6605 remoteFrame->close(); |
6606 } | 6606 } |
6607 | 6607 |
6608 class MockDocumentThreadableLoaderClient : public DocumentThreadableLoaderClient
{ | 6608 class MockDocumentThreadableLoaderClient : public DocumentThreadableLoaderClient
{ |
6609 public: | 6609 public: |
6610 MockDocumentThreadableLoaderClient() : m_failed(false) { } | 6610 MockDocumentThreadableLoaderClient() : m_failed(false) { } |
6611 virtual void didFail(const ResourceError&) OVERRIDE { m_failed = true;} | 6611 virtual void didFail(const ResourceError&) override { m_failed = true;} |
6612 | 6612 |
6613 void reset() { m_failed = false; } | 6613 void reset() { m_failed = false; } |
6614 bool failed() { return m_failed; } | 6614 bool failed() { return m_failed; } |
6615 | 6615 |
6616 bool m_failed; | 6616 bool m_failed; |
6617 }; | 6617 }; |
6618 | 6618 |
6619 // FIXME: This would be better as a unittest on DocumentThreadableLoader but it | 6619 // FIXME: This would be better as a unittest on DocumentThreadableLoader but it |
6620 // requires spin-up of a frame. It may be possible to remove that requirement | 6620 // requires spin-up of a frame. It may be possible to remove that requirement |
6621 // and convert it to a unittest. | 6621 // and convert it to a unittest. |
(...skipping 28 matching lines...) Expand all Loading... |
6650 EXPECT_FALSE(client.failed()); | 6650 EXPECT_FALSE(client.failed()); |
6651 } | 6651 } |
6652 | 6652 |
6653 class NavigationTransitionCallbackWebFrameClient : public FrameTestHelpers::Test
WebFrameClient { | 6653 class NavigationTransitionCallbackWebFrameClient : public FrameTestHelpers::Test
WebFrameClient { |
6654 public: | 6654 public: |
6655 NavigationTransitionCallbackWebFrameClient() | 6655 NavigationTransitionCallbackWebFrameClient() |
6656 : m_navigationalDataReceivedCount(0) | 6656 : m_navigationalDataReceivedCount(0) |
6657 , m_provisionalLoadCount(0) | 6657 , m_provisionalLoadCount(0) |
6658 , m_wasLastProvisionalLoadATransition(false) { } | 6658 , m_wasLastProvisionalLoadATransition(false) { } |
6659 | 6659 |
6660 virtual void addNavigationTransitionData(const WebString& allowedDestination
Origin, const WebString& selector, const WebString& markup) OVERRIDE | 6660 virtual void addNavigationTransitionData(const WebString& allowedDestination
Origin, const WebString& selector, const WebString& markup) override |
6661 { | 6661 { |
6662 m_navigationalDataReceivedCount++; | 6662 m_navigationalDataReceivedCount++; |
6663 } | 6663 } |
6664 | 6664 |
6665 virtual void didStartProvisionalLoad(WebLocalFrame* localFrame, bool isTrans
itionNavigation) OVERRIDE | 6665 virtual void didStartProvisionalLoad(WebLocalFrame* localFrame, bool isTrans
itionNavigation) override |
6666 { | 6666 { |
6667 m_provisionalLoadCount++; | 6667 m_provisionalLoadCount++; |
6668 m_wasLastProvisionalLoadATransition = isTransitionNavigation; | 6668 m_wasLastProvisionalLoadATransition = isTransitionNavigation; |
6669 } | 6669 } |
6670 | 6670 |
6671 unsigned navigationalDataReceivedCount() const { return m_navigationalDataRe
ceivedCount; } | 6671 unsigned navigationalDataReceivedCount() const { return m_navigationalDataRe
ceivedCount; } |
6672 unsigned provisionalLoadCount() const { return m_provisionalLoadCount; } | 6672 unsigned provisionalLoadCount() const { return m_provisionalLoadCount; } |
6673 bool wasLastProvisionalLoadATransition() const { return m_wasLastProvisional
LoadATransition; } | 6673 bool wasLastProvisionalLoadATransition() const { return m_wasLastProvisional
LoadATransition; } |
6674 | 6674 |
6675 private: | 6675 private: |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6709 EXPECT_EQ(1u, frameClient.navigationalDataReceivedCount()); | 6709 EXPECT_EQ(1u, frameClient.navigationalDataReceivedCount()); |
6710 | 6710 |
6711 // Neither should a page reload. | 6711 // Neither should a page reload. |
6712 localFrame->reload(); | 6712 localFrame->reload(); |
6713 EXPECT_EQ(4u, frameClient.provisionalLoadCount()); | 6713 EXPECT_EQ(4u, frameClient.provisionalLoadCount()); |
6714 EXPECT_FALSE(frameClient.wasLastProvisionalLoadATransition()); | 6714 EXPECT_FALSE(frameClient.wasLastProvisionalLoadATransition()); |
6715 EXPECT_EQ(1u, frameClient.navigationalDataReceivedCount()); | 6715 EXPECT_EQ(1u, frameClient.navigationalDataReceivedCount()); |
6716 } | 6716 } |
6717 | 6717 |
6718 } // namespace | 6718 } // namespace |
OLD | NEW |