Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(19)

Side by Side Diff: Source/web/tests/WebFrameTest.cpp

Issue 339593005: Set the target type when creating the request for main resource (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 2713 matching lines...) Expand 10 before | Expand all | Expand 10 after
2724 { 2724 {
2725 // Test that reloading while the previous load is still pending does not cau se the initial 2725 // Test that reloading while the previous load is still pending does not cau se the initial
2726 // request to get lost. 2726 // request to get lost.
2727 registerMockedHttpURLLoad("fixed_layout.html"); 2727 registerMockedHttpURLLoad("fixed_layout.html");
2728 2728
2729 FrameTestHelpers::WebViewHelper webViewHelper; 2729 FrameTestHelpers::WebViewHelper webViewHelper;
2730 webViewHelper.initialize(); 2730 webViewHelper.initialize();
2731 WebURLRequest request; 2731 WebURLRequest request;
2732 request.initialize(); 2732 request.initialize();
2733 request.setURL(toKURL(m_baseURL + "fixed_layout.html")); 2733 request.setURL(toKURL(m_baseURL + "fixed_layout.html"));
2734 request.initializeForMainResource(true);
2734 webViewHelper.webView()->mainFrame()->loadRequest(request); 2735 webViewHelper.webView()->mainFrame()->loadRequest(request);
2735 // start reload before first request is delivered. 2736 // start reload before first request is delivered.
2736 FrameTestHelpers::reloadFrameIgnoringCache(webViewHelper.webView()->mainFram e()); 2737 FrameTestHelpers::reloadFrameIgnoringCache(webViewHelper.webView()->mainFram e());
2737 2738
2738 WebDataSource* dataSource = webViewHelper.webView()->mainFrame()->dataSource (); 2739 WebDataSource* dataSource = webViewHelper.webView()->mainFrame()->dataSource ();
2739 ASSERT_TRUE(dataSource); 2740 ASSERT_TRUE(dataSource);
2740 EXPECT_EQ(toKURL(m_baseURL + "fixed_layout.html"), toKURL(dataSource->reques t().url().spec())); 2741 EXPECT_EQ(toKURL(m_baseURL + "fixed_layout.html"), toKURL(dataSource->reques t().url().spec()));
2741 } 2742 }
2742 2743
2743 TEST_F(WebFrameTest, AppendRedirects) 2744 TEST_F(WebFrameTest, AppendRedirects)
(...skipping 2304 matching lines...) Expand 10 before | Expand all | Expand 10 after
5048 }; 5049 };
5049 5050
5050 TEST_F(WebFrameTest, NavigateToSame) 5051 TEST_F(WebFrameTest, NavigateToSame)
5051 { 5052 {
5052 registerMockedHttpURLLoad("navigate_to_same.html"); 5053 registerMockedHttpURLLoad("navigate_to_same.html");
5053 TestSameDocumentWebFrameClient client; 5054 TestSameDocumentWebFrameClient client;
5054 FrameTestHelpers::WebViewHelper webViewHelper; 5055 FrameTestHelpers::WebViewHelper webViewHelper;
5055 webViewHelper.initializeAndLoad(m_baseURL + "navigate_to_same.html", true, & client); 5056 webViewHelper.initializeAndLoad(m_baseURL + "navigate_to_same.html", true, & client);
5056 EXPECT_FALSE(client.frameLoadTypeSameSeen()); 5057 EXPECT_FALSE(client.frameLoadTypeSameSeen());
5057 5058
5058 WebCore::FrameLoadRequest frameRequest(0, WebCore::ResourceRequest(toLocalFr ame(webViewHelper.webViewImpl()->page()->mainFrame())->document()->url())); 5059 WebCore::ResourceRequest request = WebCore::ResourceRequest(
5060 toLocalFrame(webViewHelper.webViewImpl()->page()->mainFrame())->document ()->url());
5061 request.initializeForMainResource(true);
5062 WebCore::FrameLoadRequest frameRequest(0, request);
5059 toLocalFrame(webViewHelper.webViewImpl()->page()->mainFrame())->loader().loa d(frameRequest); 5063 toLocalFrame(webViewHelper.webViewImpl()->page()->mainFrame())->loader().loa d(frameRequest);
5060 FrameTestHelpers::pumpPendingRequestsDoNotUse(webViewHelper.webView()->mainF rame()); 5064 FrameTestHelpers::pumpPendingRequestsDoNotUse(webViewHelper.webView()->mainF rame());
5061 5065
5062 EXPECT_TRUE(client.frameLoadTypeSameSeen()); 5066 EXPECT_TRUE(client.frameLoadTypeSameSeen());
5063 } 5067 }
5064 5068
5065 TEST_F(WebFrameTest, WebNodeImageContents) 5069 TEST_F(WebFrameTest, WebNodeImageContents)
5066 { 5070 {
5067 FrameTestHelpers::WebViewHelper webViewHelper; 5071 FrameTestHelpers::WebViewHelper webViewHelper;
5068 webViewHelper.initializeAndLoad("about:blank", true); 5072 webViewHelper.initializeAndLoad("about:blank", true);
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
5268 registerMockedHttpURLLoad("fixed_layout.html"); 5272 registerMockedHttpURLLoad("fixed_layout.html");
5269 std::string url = m_baseURL + "fixed_layout.html"; 5273 std::string url = m_baseURL + "fixed_layout.html";
5270 5274
5271 FrameTestHelpers::WebViewHelper webViewHelper; 5275 FrameTestHelpers::WebViewHelper webViewHelper;
5272 webViewHelper.initialize(); 5276 webViewHelper.initialize();
5273 WebFrame* frame = webViewHelper.webView()->mainFrame(); 5277 WebFrame* frame = webViewHelper.webView()->mainFrame();
5274 const WebCore::FrameLoader& mainFrameLoader = webViewHelper.webViewImpl()->m ainFrameImpl()->frame()->loader(); 5278 const WebCore::FrameLoader& mainFrameLoader = webViewHelper.webViewImpl()->m ainFrameImpl()->frame()->loader();
5275 WebURLRequest request; 5279 WebURLRequest request;
5276 request.initialize(); 5280 request.initialize();
5277 request.setURL(toKURL(url)); 5281 request.setURL(toKURL(url));
5282 request.initializeForMainResource(true);
5278 frame->loadRequest(request); 5283 frame->loadRequest(request);
5279 5284
5280 // Before commit, there is no history item. 5285 // Before commit, there is no history item.
5281 EXPECT_FALSE(mainFrameLoader.currentItem()); 5286 EXPECT_FALSE(mainFrameLoader.currentItem());
5282 5287
5283 FrameTestHelpers::pumpPendingRequestsDoNotUse(frame); 5288 FrameTestHelpers::pumpPendingRequestsDoNotUse(frame);
5284 5289
5285 // After commit, there is. 5290 // After commit, there is.
5286 WebCore::HistoryItem* item = mainFrameLoader.currentItem(); 5291 WebCore::HistoryItem* item = mainFrameLoader.currentItem();
5287 ASSERT_TRUE(item); 5292 ASSERT_TRUE(item);
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
5577 { 5582 {
5578 registerMockedHttpURLLoad("brand_color_test.html"); 5583 registerMockedHttpURLLoad("brand_color_test.html");
5579 FrameTestHelpers::WebViewHelper webViewHelper; 5584 FrameTestHelpers::WebViewHelper webViewHelper;
5580 BrandColorTestWebFrameClient client; 5585 BrandColorTestWebFrameClient client;
5581 webViewHelper.initializeAndLoad(m_baseURL + "brand_color_test.html", false, &client); 5586 webViewHelper.initializeAndLoad(m_baseURL + "brand_color_test.html", false, &client);
5582 EXPECT_TRUE(client.didNotify()); 5587 EXPECT_TRUE(client.didNotify());
5583 EXPECT_EQ(0xff0000ff, client.brandColor()); 5588 EXPECT_EQ(0xff0000ff, client.brandColor());
5584 } 5589 }
5585 5590
5586 } // namespace 5591 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698