| 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 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 491 FrameTestHelpers::WebViewHelper webViewHelper(this); | 491 FrameTestHelpers::WebViewHelper webViewHelper(this); |
| 492 | 492 |
| 493 /// Pass true to enable JavaScript. | 493 /// Pass true to enable JavaScript. |
| 494 webViewHelper.initializeAndLoad(m_baseURL + fileName, true); | 494 webViewHelper.initializeAndLoad(m_baseURL + fileName, true); |
| 495 | 495 |
| 496 // Setting host to "hostname:" should be treated as "hostname:0". | 496 // Setting host to "hostname:" should be treated as "hostname:0". |
| 497 FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), "javascrip
t:location.host = 'internal.test:'; void 0;"); | 497 FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), "javascrip
t:location.host = 'internal.test:'; void 0;"); |
| 498 | 498 |
| 499 FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), "javascrip
t:document.body.textContent = location.href; void 0;"); | 499 FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), "javascrip
t:document.body.textContent = location.href; void 0;"); |
| 500 | 500 |
| 501 // Required to see any updates in dumpFrameTreeAsText. |
| 502 webViewHelper.webView()->updateAllLifecyclePhases(); |
| 503 |
| 501 std::string content = WebFrameContentDumper::dumpFrameTreeAsText(webViewHelp
er.webView()->mainFrame()->toWebLocalFrame(), 1024).utf8(); | 504 std::string content = WebFrameContentDumper::dumpFrameTreeAsText(webViewHelp
er.webView()->mainFrame()->toWebLocalFrame(), 1024).utf8(); |
| 502 EXPECT_EQ("http://internal.test:0/" + fileName, content); | 505 EXPECT_EQ("http://internal.test:0/" + fileName, content); |
| 503 } | 506 } |
| 504 | 507 |
| 505 TEST_P(ParameterizedWebFrameTest, LocationSetEmptyPort) | 508 TEST_P(ParameterizedWebFrameTest, LocationSetEmptyPort) |
| 506 { | 509 { |
| 507 std::string fileName = "print-location-href.html"; | 510 std::string fileName = "print-location-href.html"; |
| 508 registerMockedHttpURLLoad(fileName); | 511 registerMockedHttpURLLoad(fileName); |
| 509 URLTestHelpers::registerMockedURLLoad(toKURL("http://internal.test:0/" + fil
eName), WebString::fromUTF8(fileName)); | 512 URLTestHelpers::registerMockedURLLoad(toKURL("http://internal.test:0/" + fil
eName), WebString::fromUTF8(fileName)); |
| 510 | 513 |
| 511 FrameTestHelpers::WebViewHelper webViewHelper(this); | 514 FrameTestHelpers::WebViewHelper webViewHelper(this); |
| 512 | 515 |
| 513 /// Pass true to enable JavaScript. | 516 /// Pass true to enable JavaScript. |
| 514 webViewHelper.initializeAndLoad(m_baseURL + fileName, true); | 517 webViewHelper.initializeAndLoad(m_baseURL + fileName, true); |
| 515 | 518 |
| 516 FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), "javascrip
t:location.port = ''; void 0;"); | 519 FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), "javascrip
t:location.port = ''; void 0;"); |
| 517 | 520 |
| 518 FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), "javascrip
t:document.body.textContent = location.href; void 0;"); | 521 FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), "javascrip
t:document.body.textContent = location.href; void 0;"); |
| 519 | 522 |
| 523 // Required to see any updates in dumpFrameTreeAsText. |
| 524 webViewHelper.webView()->updateAllLifecyclePhases(); |
| 525 |
| 520 std::string content = WebFrameContentDumper::dumpFrameTreeAsText(webViewHelp
er.webView()->mainFrame()->toWebLocalFrame(), 1024).utf8(); | 526 std::string content = WebFrameContentDumper::dumpFrameTreeAsText(webViewHelp
er.webView()->mainFrame()->toWebLocalFrame(), 1024).utf8(); |
| 521 EXPECT_EQ("http://internal.test:0/" + fileName, content); | 527 EXPECT_EQ("http://internal.test:0/" + fileName, content); |
| 522 } | 528 } |
| 523 | 529 |
| 524 class EvaluateOnLoadWebFrameClient : public FrameTestHelpers::TestWebFrameClient
{ | 530 class EvaluateOnLoadWebFrameClient : public FrameTestHelpers::TestWebFrameClient
{ |
| 525 public: | 531 public: |
| 526 EvaluateOnLoadWebFrameClient() : m_executing(false), m_wasExecuted(false) {
} | 532 EvaluateOnLoadWebFrameClient() : m_executing(false), m_wasExecuted(false) {
} |
| 527 | 533 |
| 528 void didClearWindowObject(WebLocalFrame* frame) override | 534 void didClearWindowObject(WebLocalFrame* frame) override |
| 529 { | 535 { |
| (...skipping 4224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4754 FrameTestHelpers::WebViewHelper webViewHelper(this); | 4760 FrameTestHelpers::WebViewHelper webViewHelper(this); |
| 4755 webViewHelper.initialize(true, 0, &fakeSelectionWebViewClient); | 4761 webViewHelper.initialize(true, 0, &fakeSelectionWebViewClient); |
| 4756 webViewHelper.webView()->settings()->setDefaultFontSize(12); | 4762 webViewHelper.webView()->settings()->setDefaultFontSize(12); |
| 4757 webViewHelper.webView()->setDefaultPageScaleLimits(1, 1); | 4763 webViewHelper.webView()->setDefaultPageScaleLimits(1, 1); |
| 4758 webViewHelper.resize(WebSize(viewWidth, viewHeight)); | 4764 webViewHelper.resize(WebSize(viewWidth, viewHeight)); |
| 4759 FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), m_baseURL
+ "select_range_basic.html"); | 4765 FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), m_baseURL
+ "select_range_basic.html"); |
| 4760 | 4766 |
| 4761 // The frame starts with no selection. | 4767 // The frame starts with no selection. |
| 4762 WebFrame* frame = webViewHelper.webView()->mainFrame(); | 4768 WebFrame* frame = webViewHelper.webView()->mainFrame(); |
| 4763 ASSERT_TRUE(frame->hasSelection()); | 4769 ASSERT_TRUE(frame->hasSelection()); |
| 4764 EXPECT_TRUE(fakeSelectionLayerTreeView.getAndResetSelectionCleared()); | 4770 EXPECT_FALSE(fakeSelectionLayerTreeView.selection()); |
| 4765 | 4771 |
| 4766 // The selection cleared notification should be triggered upon layout. | 4772 // The selection cleared notification should be triggered upon layout. |
| 4767 frame->executeCommand(WebString::fromUTF8("Unselect")); | 4773 frame->executeCommand(WebString::fromUTF8("Unselect")); |
| 4768 ASSERT_FALSE(frame->hasSelection()); | 4774 ASSERT_FALSE(frame->hasSelection()); |
| 4769 EXPECT_FALSE(fakeSelectionLayerTreeView.getAndResetSelectionCleared()); | 4775 EXPECT_FALSE(fakeSelectionLayerTreeView.getAndResetSelectionCleared()); |
| 4770 webViewHelper.webView()->updateAllLifecyclePhases(); | 4776 webViewHelper.webView()->updateAllLifecyclePhases(); |
| 4771 EXPECT_TRUE(fakeSelectionLayerTreeView.getAndResetSelectionCleared()); | 4777 EXPECT_TRUE(fakeSelectionLayerTreeView.getAndResetSelectionCleared()); |
| 4772 | 4778 |
| 4773 frame->executeCommand(WebString::fromUTF8("SelectAll")); | 4779 frame->executeCommand(WebString::fromUTF8("SelectAll")); |
| 4774 webViewHelper.webView()->updateAllLifecyclePhases(); | 4780 webViewHelper.webView()->updateAllLifecyclePhases(); |
| (...skipping 3706 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8481 } | 8487 } |
| 8482 | 8488 |
| 8483 TEST_F(WebFrameVisibilityChangeTest, RemoteFrameParentVisibilityChange) | 8489 TEST_F(WebFrameVisibilityChangeTest, RemoteFrameParentVisibilityChange) |
| 8484 { | 8490 { |
| 8485 swapLocalFrameToRemoteFrame(); | 8491 swapLocalFrameToRemoteFrame(); |
| 8486 executeScriptOnMainFrame(WebScriptSource("document.querySelector('iframe').p
arentElement.style.display = 'none';")); | 8492 executeScriptOnMainFrame(WebScriptSource("document.querySelector('iframe').p
arentElement.style.display = 'none';")); |
| 8487 EXPECT_FALSE(remoteFrameClient()->isVisible()); | 8493 EXPECT_FALSE(remoteFrameClient()->isVisible()); |
| 8488 } | 8494 } |
| 8489 | 8495 |
| 8490 } // namespace blink | 8496 } // namespace blink |
| OLD | NEW |