| 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 3305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3316 { | 3316 { |
| 3317 // Test that reloading while the previous load is still pending does not cau
se the initial | 3317 // Test that reloading while the previous load is still pending does not cau
se the initial |
| 3318 // request to get lost. | 3318 // request to get lost. |
| 3319 registerMockedHttpURLLoad("fixed_layout.html"); | 3319 registerMockedHttpURLLoad("fixed_layout.html"); |
| 3320 | 3320 |
| 3321 FrameTestHelpers::WebViewHelper webViewHelper(this); | 3321 FrameTestHelpers::WebViewHelper webViewHelper(this); |
| 3322 webViewHelper.initialize(); | 3322 webViewHelper.initialize(); |
| 3323 WebURLRequest request; | 3323 WebURLRequest request; |
| 3324 request.initialize(); | 3324 request.initialize(); |
| 3325 request.setURL(toKURL(m_baseURL + "fixed_layout.html")); | 3325 request.setURL(toKURL(m_baseURL + "fixed_layout.html")); |
| 3326 request.setRequestorOrigin(WebSecurityOrigin::createUnique()); |
| 3326 webViewHelper.webView()->mainFrame()->loadRequest(request); | 3327 webViewHelper.webView()->mainFrame()->loadRequest(request); |
| 3327 // start reload before first request is delivered. | 3328 // start reload before first request is delivered. |
| 3328 FrameTestHelpers::reloadFrameIgnoringCache(webViewHelper.webView()->mainFram
e()); | 3329 FrameTestHelpers::reloadFrameIgnoringCache(webViewHelper.webView()->mainFram
e()); |
| 3329 | 3330 |
| 3330 WebDataSource* dataSource = webViewHelper.webView()->mainFrame()->dataSource
(); | 3331 WebDataSource* dataSource = webViewHelper.webView()->mainFrame()->dataSource
(); |
| 3331 ASSERT_TRUE(dataSource); | 3332 ASSERT_TRUE(dataSource); |
| 3332 EXPECT_EQ(toKURL(m_baseURL + "fixed_layout.html"), KURL(dataSource->request(
).url())); | 3333 EXPECT_EQ(toKURL(m_baseURL + "fixed_layout.html"), KURL(dataSource->request(
).url())); |
| 3333 } | 3334 } |
| 3334 | 3335 |
| 3335 TEST_P(ParameterizedWebFrameTest, AppendRedirects) | 3336 TEST_P(ParameterizedWebFrameTest, AppendRedirects) |
| (...skipping 2950 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6286 registerMockedHttpURLLoad("fixed_layout.html"); | 6287 registerMockedHttpURLLoad("fixed_layout.html"); |
| 6287 std::string url = m_baseURL + "fixed_layout.html"; | 6288 std::string url = m_baseURL + "fixed_layout.html"; |
| 6288 | 6289 |
| 6289 FrameTestHelpers::WebViewHelper webViewHelper(this); | 6290 FrameTestHelpers::WebViewHelper webViewHelper(this); |
| 6290 webViewHelper.initialize(); | 6291 webViewHelper.initialize(); |
| 6291 WebFrame* frame = webViewHelper.webView()->mainFrame(); | 6292 WebFrame* frame = webViewHelper.webView()->mainFrame(); |
| 6292 const FrameLoader& mainFrameLoader = webViewHelper.webViewImpl()->mainFrameI
mpl()->frame()->loader(); | 6293 const FrameLoader& mainFrameLoader = webViewHelper.webViewImpl()->mainFrameI
mpl()->frame()->loader(); |
| 6293 WebURLRequest request; | 6294 WebURLRequest request; |
| 6294 request.initialize(); | 6295 request.initialize(); |
| 6295 request.setURL(toKURL(url)); | 6296 request.setURL(toKURL(url)); |
| 6297 request.setRequestorOrigin(WebSecurityOrigin::createUnique()); |
| 6296 frame->loadRequest(request); | 6298 frame->loadRequest(request); |
| 6297 | 6299 |
| 6298 // Before commit, there is no history item. | 6300 // Before commit, there is no history item. |
| 6299 EXPECT_FALSE(mainFrameLoader.currentItem()); | 6301 EXPECT_FALSE(mainFrameLoader.currentItem()); |
| 6300 | 6302 |
| 6301 FrameTestHelpers::pumpPendingRequestsForFrameToLoad(frame); | 6303 FrameTestHelpers::pumpPendingRequestsForFrameToLoad(frame); |
| 6302 | 6304 |
| 6303 // After commit, there is. | 6305 // After commit, there is. |
| 6304 HistoryItem* item = mainFrameLoader.currentItem(); | 6306 HistoryItem* item = mainFrameLoader.currentItem(); |
| 6305 ASSERT_TRUE(item); | 6307 ASSERT_TRUE(item); |
| (...skipping 2499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8805 TEST_F(WebFrameTest, LoadJavascriptURLInNewFrame) | 8807 TEST_F(WebFrameTest, LoadJavascriptURLInNewFrame) |
| 8806 { | 8808 { |
| 8807 FrameTestHelpers::WebViewHelper helper; | 8809 FrameTestHelpers::WebViewHelper helper; |
| 8808 helper.initialize(true); | 8810 helper.initialize(true); |
| 8809 | 8811 |
| 8810 WebURLRequest request; | 8812 WebURLRequest request; |
| 8811 std::string redirectURL = m_baseURL + "foo.html"; | 8813 std::string redirectURL = m_baseURL + "foo.html"; |
| 8812 URLTestHelpers::registerMockedURLLoad(toKURL(redirectURL), "foo.html"); | 8814 URLTestHelpers::registerMockedURLLoad(toKURL(redirectURL), "foo.html"); |
| 8813 request.initialize(); | 8815 request.initialize(); |
| 8814 request.setURL(toKURL("javascript:location='" + redirectURL + "'")); | 8816 request.setURL(toKURL("javascript:location='" + redirectURL + "'")); |
| 8817 request.setRequestorOrigin(WebSecurityOrigin::createUnique()); |
| 8815 helper.webViewImpl()->mainFrame()->toWebLocalFrame()->loadRequest(request); | 8818 helper.webViewImpl()->mainFrame()->toWebLocalFrame()->loadRequest(request); |
| 8816 | 8819 |
| 8817 // Normally, the result of the JS url replaces the existing contents on the | 8820 // Normally, the result of the JS url replaces the existing contents on the |
| 8818 // Document. However, if the JS triggers a navigation, the contents should | 8821 // Document. However, if the JS triggers a navigation, the contents should |
| 8819 // not be replaced. | 8822 // not be replaced. |
| 8820 EXPECT_EQ("", toLocalFrame(helper.webViewImpl()->page()->mainFrame())->docum
ent()->documentElement()->innerText()); | 8823 EXPECT_EQ("", toLocalFrame(helper.webViewImpl()->page()->mainFrame())->docum
ent()->documentElement()->innerText()); |
| 8821 } | 8824 } |
| 8822 | 8825 |
| 8823 } // namespace blink | 8826 } // namespace blink |
| OLD | NEW |