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 5974 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5985 } | 5985 } |
5986 | 5986 |
5987 bool replacesCurrentHistoryItem() { return m_replacesCurrentHistoryItem; } | 5987 bool replacesCurrentHistoryItem() { return m_replacesCurrentHistoryItem; } |
5988 WebFrame* frame() { return m_frame; } | 5988 WebFrame* frame() { return m_frame; } |
5989 | 5989 |
5990 private: | 5990 private: |
5991 bool m_replacesCurrentHistoryItem; | 5991 bool m_replacesCurrentHistoryItem; |
5992 WebFrame* m_frame; | 5992 WebFrame* m_frame; |
5993 }; | 5993 }; |
5994 | 5994 |
5995 // Tests that the first navigation in an initially blank subframe will result in | 5995 // Test which ensures that the first navigation in a subframe will always |
5996 // a history entry being replaced and not a new one being added. | 5996 // result in history entry being replaced and not a new one added. |
5997 TEST_P(ParameterizedWebFrameTest, FirstBlankSubframeNavigation) | 5997 TEST_P(ParameterizedWebFrameTest, DISABLED_FirstFrameNavigationReplacesHistory) |
5998 { | 5998 { |
5999 registerMockedHttpURLLoad("history.html"); | 5999 registerMockedHttpURLLoad("history.html"); |
6000 registerMockedHttpURLLoad("find.html"); | 6000 registerMockedHttpURLLoad("find.html"); |
6001 | 6001 |
6002 FrameTestHelpers::WebViewHelper webViewHelper(this); | 6002 FrameTestHelpers::WebViewHelper webViewHelper(this); |
6003 TestHistoryWebFrameClient client; | 6003 TestHistoryWebFrameClient client; |
6004 webViewHelper.initializeAndLoad("about:blank", true, &client); | 6004 webViewHelper.initializeAndLoad("about:blank", true, &client); |
| 6005 EXPECT_TRUE(client.replacesCurrentHistoryItem()); |
6005 | 6006 |
6006 WebFrame* frame = webViewHelper.webView()->mainFrame(); | 6007 WebFrame* frame = webViewHelper.webView()->mainFrame(); |
6007 | 6008 |
6008 frame->executeScript(WebScriptSource(WebString::fromUTF8( | 6009 FrameTestHelpers::loadFrame(frame, |
6009 "document.body.appendChild(document.createElement('iframe'))"))); | 6010 "javascript:document.body.appendChild(document.createElement('iframe'))"
); |
6010 | |
6011 WebFrame* iframe = frame->firstChild(); | 6011 WebFrame* iframe = frame->firstChild(); |
6012 ASSERT_EQ(&client, toWebLocalFrameImpl(iframe)->client()); | 6012 EXPECT_EQ(client.frame(), iframe); |
6013 EXPECT_EQ(iframe, client.frame()); | |
6014 | |
6015 std::string url1 = m_baseURL + "history.html"; | |
6016 FrameTestHelpers::loadFrame(iframe, url1); | |
6017 EXPECT_EQ(iframe, client.frame()); | |
6018 EXPECT_EQ(url1, iframe->document().url().string().utf8()); | |
6019 EXPECT_TRUE(client.replacesCurrentHistoryItem()); | 6013 EXPECT_TRUE(client.replacesCurrentHistoryItem()); |
6020 | 6014 |
6021 std::string url2 = m_baseURL + "find.html"; | 6015 FrameTestHelpers::loadFrame(frame, |
6022 FrameTestHelpers::loadFrame(iframe, url2); | 6016 "javascript:window.frames[0].location.assign('" + m_baseURL + "history.h
tml')"); |
6023 EXPECT_EQ(iframe, client.frame()); | 6017 EXPECT_EQ(client.frame(), iframe); |
6024 EXPECT_EQ(url2, iframe->document().url().string().utf8()); | 6018 EXPECT_TRUE(client.replacesCurrentHistoryItem()); |
| 6019 |
| 6020 FrameTestHelpers::loadFrame(frame, |
| 6021 "javascript:window.frames[0].location.assign('" + m_baseURL + "find.html
')"); |
| 6022 EXPECT_EQ(client.frame(), iframe); |
| 6023 EXPECT_FALSE(client.replacesCurrentHistoryItem()); |
| 6024 |
| 6025 // Repeat the test, but start out the iframe with initial URL, which is not |
| 6026 // "about:blank". |
| 6027 FrameTestHelpers::loadFrame(frame, |
| 6028 "javascript:var f = document.createElement('iframe'); " |
| 6029 "f.src = '" + m_baseURL + "history.html';" |
| 6030 "document.body.appendChild(f)"); |
| 6031 |
| 6032 iframe = frame->firstChild()->nextSibling(); |
| 6033 EXPECT_EQ(client.frame(), iframe); |
| 6034 EXPECT_TRUE(client.replacesCurrentHistoryItem()); |
| 6035 |
| 6036 FrameTestHelpers::loadFrame(frame, |
| 6037 "javascript:window.frames[1].location.assign('" + m_baseURL + "find.html
')"); |
| 6038 EXPECT_EQ(client.frame(), iframe); |
6025 EXPECT_FALSE(client.replacesCurrentHistoryItem()); | 6039 EXPECT_FALSE(client.replacesCurrentHistoryItem()); |
6026 } | 6040 } |
6027 | 6041 |
6028 // Tests that a navigation in a frame with a non-blank initial URL will create | |
6029 // a new history item, unlike the case above. | |
6030 TEST_P(ParameterizedWebFrameTest, FirstNonBlankSubframeNavigation) | |
6031 { | |
6032 registerMockedHttpURLLoad("history.html"); | |
6033 registerMockedHttpURLLoad("find.html"); | |
6034 | |
6035 FrameTestHelpers::WebViewHelper webViewHelper(this); | |
6036 TestHistoryWebFrameClient client; | |
6037 webViewHelper.initializeAndLoad("about:blank", true, &client); | |
6038 | |
6039 WebFrame* frame = webViewHelper.webView()->mainFrame(); | |
6040 | |
6041 std::string url1 = m_baseURL + "history.html"; | |
6042 FrameTestHelpers::loadFrame(frame, | |
6043 "javascript:var f = document.createElement('iframe'); " | |
6044 "f.src = '" + url1 + "';" | |
6045 "document.body.appendChild(f)"); | |
6046 | |
6047 WebFrame* iframe = frame->firstChild(); | |
6048 EXPECT_EQ(iframe, client.frame()); | |
6049 EXPECT_EQ(url1, iframe->document().url().string().utf8()); | |
6050 | |
6051 std::string url2 = m_baseURL + "find.html"; | |
6052 FrameTestHelpers::loadFrame(iframe, url2); | |
6053 EXPECT_EQ(iframe, client.frame()); | |
6054 EXPECT_EQ(url2, iframe->document().url().string().utf8()); | |
6055 EXPECT_FALSE(client.replacesCurrentHistoryItem()); | |
6056 } | |
6057 | |
6058 // Test verifies that layout will change a layer's scrollable attibutes | 6042 // Test verifies that layout will change a layer's scrollable attibutes |
6059 TEST_F(WebFrameTest, overflowHiddenRewrite) | 6043 TEST_F(WebFrameTest, overflowHiddenRewrite) |
6060 { | 6044 { |
6061 registerMockedHttpURLLoad("non-scrollable.html"); | 6045 registerMockedHttpURLLoad("non-scrollable.html"); |
6062 OwnPtr<FakeCompositingWebViewClient> fakeCompositingWebViewClient = adoptPtr
(new FakeCompositingWebViewClient()); | 6046 OwnPtr<FakeCompositingWebViewClient> fakeCompositingWebViewClient = adoptPtr
(new FakeCompositingWebViewClient()); |
6063 FrameTestHelpers::WebViewHelper webViewHelper; | 6047 FrameTestHelpers::WebViewHelper webViewHelper; |
6064 webViewHelper.initialize(true, 0, fakeCompositingWebViewClient.get(), &confi
gueCompositingWebView); | 6048 webViewHelper.initialize(true, 0, fakeCompositingWebViewClient.get(), &confi
gueCompositingWebView); |
6065 | 6049 |
6066 webViewHelper.webView()->resize(WebSize(100, 100)); | 6050 webViewHelper.webView()->resize(WebSize(100, 100)); |
6067 FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), m_baseURL
+ "non-scrollable.html"); | 6051 FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), m_baseURL
+ "non-scrollable.html"); |
(...skipping 1413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7481 | 7465 |
7482 EXPECT_EQ(parent, firstFrame->parent()); | 7466 EXPECT_EQ(parent, firstFrame->parent()); |
7483 EXPECT_EQ(parent, secondFrame->parent()); | 7467 EXPECT_EQ(parent, secondFrame->parent()); |
7484 EXPECT_EQ(parent, thirdFrame->parent()); | 7468 EXPECT_EQ(parent, thirdFrame->parent()); |
7485 EXPECT_EQ(parent, fourthFrame->parent()); | 7469 EXPECT_EQ(parent, fourthFrame->parent()); |
7486 | 7470 |
7487 view->close(); | 7471 view->close(); |
7488 } | 7472 } |
7489 | 7473 |
7490 } // namespace blink | 7474 } // namespace blink |
OLD | NEW |