| 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 2338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2349 FrameTestHelpers::WebViewHelper webViewHelper; | 2349 FrameTestHelpers::WebViewHelper webViewHelper; |
| 2350 webViewHelper.initialize(false, &webFrameClient); | 2350 webViewHelper.initialize(false, &webFrameClient); |
| 2351 FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), m_baseURL
+ "fixed_layout.html"); | 2351 FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), m_baseURL
+ "fixed_layout.html"); |
| 2352 // start reload before first request is delivered. | 2352 // start reload before first request is delivered. |
| 2353 webViewHelper.webView()->mainFrame()->reload(true); | 2353 webViewHelper.webView()->mainFrame()->reload(true); |
| 2354 Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests(); | 2354 Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests(); |
| 2355 ASSERT_EQ(WebURL(toKURL(m_baseURL + "fixed_layout.html")), | 2355 ASSERT_EQ(WebURL(toKURL(m_baseURL + "fixed_layout.html")), |
| 2356 webViewHelper.webView()->mainFrame()->dataSource()->request().url()); | 2356 webViewHelper.webView()->mainFrame()->dataSource()->request().url()); |
| 2357 } | 2357 } |
| 2358 | 2358 |
| 2359 TEST_F(WebFrameTest, AppendRedirects) |
| 2360 { |
| 2361 const std::string firstURL = "about:blank"; |
| 2362 const std::string secondURL = "http://www.test.com"; |
| 2363 |
| 2364 FrameTestHelpers::WebViewHelper webViewHelper; |
| 2365 webViewHelper.initializeAndLoad(firstURL, true); |
| 2366 |
| 2367 WebDataSource* dataSource = webViewHelper.webView()->mainFrame()->dataSource
(); |
| 2368 ASSERT_TRUE(dataSource); |
| 2369 dataSource->appendRedirect(toKURL(secondURL)); |
| 2370 |
| 2371 WebVector<WebURL> redirects; |
| 2372 dataSource->redirectChain(redirects); |
| 2373 ASSERT_EQ(2U, redirects.size()); |
| 2374 EXPECT_EQ(toKURL(firstURL), toKURL(redirects[0].spec().data())); |
| 2375 EXPECT_EQ(toKURL(secondURL), toKURL(redirects[1].spec().data())); |
| 2376 } |
| 2377 |
| 2359 TEST_F(WebFrameTest, IframeRedirect) | 2378 TEST_F(WebFrameTest, IframeRedirect) |
| 2360 { | 2379 { |
| 2361 registerMockedHttpURLLoad("iframe_redirect.html"); | 2380 registerMockedHttpURLLoad("iframe_redirect.html"); |
| 2362 registerMockedHttpURLLoad("visible_iframe.html"); | 2381 registerMockedHttpURLLoad("visible_iframe.html"); |
| 2363 | 2382 |
| 2364 FrameTestHelpers::WebViewHelper webViewHelper; | 2383 FrameTestHelpers::WebViewHelper webViewHelper; |
| 2365 webViewHelper.initializeAndLoad(m_baseURL + "iframe_redirect.html", true); | 2384 webViewHelper.initializeAndLoad(m_baseURL + "iframe_redirect.html", true); |
| 2366 Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests(); /
/ Load the iframe. | 2385 Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests(); /
/ Load the iframe. |
| 2367 | 2386 |
| 2368 WebFrame* iframe = webViewHelper.webView()->findFrameByName(WebString::fromU
TF8("ifr")); | 2387 WebFrame* iframe = webViewHelper.webView()->findFrameByName(WebString::fromU
TF8("ifr")); |
| (...skipping 2146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4515 | 4534 |
| 4516 FrameTestHelpers::loadFrame(frame, | 4535 FrameTestHelpers::loadFrame(frame, |
| 4517 "javascript:window.frames[1].location.assign('" + m_baseURL + "find.html
')"); | 4536 "javascript:window.frames[1].location.assign('" + m_baseURL + "find.html
')"); |
| 4518 runPendingTasks(); | 4537 runPendingTasks(); |
| 4519 Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests(); | 4538 Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests(); |
| 4520 EXPECT_EQ(client.frame(), iframe); | 4539 EXPECT_EQ(client.frame(), iframe); |
| 4521 EXPECT_FALSE(client.replacesCurrentHistoryItem()); | 4540 EXPECT_FALSE(client.replacesCurrentHistoryItem()); |
| 4522 } | 4541 } |
| 4523 | 4542 |
| 4524 } // namespace | 4543 } // namespace |
| OLD | NEW |