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

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

Issue 2140523002: Remove WebURLRequest::initialize() and simplify WebURLRequest (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: mutable ref Created 4 years, 5 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 3302 matching lines...) Expand 10 before | Expand all | Expand 10 after
3313 3313
3314 TEST_P(ParameterizedWebFrameTest, ReloadWhileProvisional) 3314 TEST_P(ParameterizedWebFrameTest, ReloadWhileProvisional)
3315 { 3315 {
3316 // Test that reloading while the previous load is still pending does not cau se the initial 3316 // Test that reloading while the previous load is still pending does not cau se the initial
3317 // request to get lost. 3317 // request to get lost.
3318 registerMockedHttpURLLoad("fixed_layout.html"); 3318 registerMockedHttpURLLoad("fixed_layout.html");
3319 3319
3320 FrameTestHelpers::WebViewHelper webViewHelper(this); 3320 FrameTestHelpers::WebViewHelper webViewHelper(this);
3321 webViewHelper.initialize(); 3321 webViewHelper.initialize();
3322 WebURLRequest request; 3322 WebURLRequest request;
3323 request.initialize();
3324 request.setURL(toKURL(m_baseURL + "fixed_layout.html")); 3323 request.setURL(toKURL(m_baseURL + "fixed_layout.html"));
3325 request.setRequestorOrigin(WebSecurityOrigin::createUnique()); 3324 request.setRequestorOrigin(WebSecurityOrigin::createUnique());
3326 webViewHelper.webView()->mainFrame()->loadRequest(request); 3325 webViewHelper.webView()->mainFrame()->loadRequest(request);
3327 // start reload before first request is delivered. 3326 // start reload before first request is delivered.
3328 FrameTestHelpers::reloadFrameIgnoringCache(webViewHelper.webView()->mainFram e()); 3327 FrameTestHelpers::reloadFrameIgnoringCache(webViewHelper.webView()->mainFram e());
3329 3328
3330 WebDataSource* dataSource = webViewHelper.webView()->mainFrame()->dataSource (); 3329 WebDataSource* dataSource = webViewHelper.webView()->mainFrame()->dataSource ();
3331 ASSERT_TRUE(dataSource); 3330 ASSERT_TRUE(dataSource);
3332 EXPECT_EQ(toKURL(m_baseURL + "fixed_layout.html"), KURL(dataSource->request( ).url())); 3331 EXPECT_EQ(toKURL(m_baseURL + "fixed_layout.html"), KURL(dataSource->request( ).url()));
3333 } 3332 }
(...skipping 2947 matching lines...) Expand 10 before | Expand all | Expand 10 after
6281 TEST_P(ParameterizedWebFrameTest, CurrentHistoryItem) 6280 TEST_P(ParameterizedWebFrameTest, CurrentHistoryItem)
6282 { 6281 {
6283 registerMockedHttpURLLoad("fixed_layout.html"); 6282 registerMockedHttpURLLoad("fixed_layout.html");
6284 std::string url = m_baseURL + "fixed_layout.html"; 6283 std::string url = m_baseURL + "fixed_layout.html";
6285 6284
6286 FrameTestHelpers::WebViewHelper webViewHelper(this); 6285 FrameTestHelpers::WebViewHelper webViewHelper(this);
6287 webViewHelper.initialize(); 6286 webViewHelper.initialize();
6288 WebFrame* frame = webViewHelper.webView()->mainFrame(); 6287 WebFrame* frame = webViewHelper.webView()->mainFrame();
6289 const FrameLoader& mainFrameLoader = webViewHelper.webViewImpl()->mainFrameI mpl()->frame()->loader(); 6288 const FrameLoader& mainFrameLoader = webViewHelper.webViewImpl()->mainFrameI mpl()->frame()->loader();
6290 WebURLRequest request; 6289 WebURLRequest request;
6291 request.initialize();
6292 request.setURL(toKURL(url)); 6290 request.setURL(toKURL(url));
6293 request.setRequestorOrigin(WebSecurityOrigin::createUnique()); 6291 request.setRequestorOrigin(WebSecurityOrigin::createUnique());
6294 frame->loadRequest(request); 6292 frame->loadRequest(request);
6295 6293
6296 // Before commit, there is no history item. 6294 // Before commit, there is no history item.
6297 EXPECT_FALSE(mainFrameLoader.currentItem()); 6295 EXPECT_FALSE(mainFrameLoader.currentItem());
6298 6296
6299 FrameTestHelpers::pumpPendingRequestsForFrameToLoad(frame); 6297 FrameTestHelpers::pumpPendingRequestsForFrameToLoad(frame);
6300 6298
6301 // After commit, there is. 6299 // After commit, there is.
(...skipping 2499 matching lines...) Expand 10 before | Expand all | Expand 10 after
8801 } 8799 }
8802 8800
8803 TEST_F(WebFrameTest, LoadJavascriptURLInNewFrame) 8801 TEST_F(WebFrameTest, LoadJavascriptURLInNewFrame)
8804 { 8802 {
8805 FrameTestHelpers::WebViewHelper helper; 8803 FrameTestHelpers::WebViewHelper helper;
8806 helper.initialize(true); 8804 helper.initialize(true);
8807 8805
8808 WebURLRequest request; 8806 WebURLRequest request;
8809 std::string redirectURL = m_baseURL + "foo.html"; 8807 std::string redirectURL = m_baseURL + "foo.html";
8810 URLTestHelpers::registerMockedURLLoad(toKURL(redirectURL), "foo.html"); 8808 URLTestHelpers::registerMockedURLLoad(toKURL(redirectURL), "foo.html");
8811 request.initialize();
8812 request.setURL(toKURL("javascript:location='" + redirectURL + "'")); 8809 request.setURL(toKURL("javascript:location='" + redirectURL + "'"));
8813 request.setRequestorOrigin(WebSecurityOrigin::createUnique()); 8810 request.setRequestorOrigin(WebSecurityOrigin::createUnique());
8814 helper.webViewImpl()->mainFrame()->toWebLocalFrame()->loadRequest(request); 8811 helper.webViewImpl()->mainFrame()->toWebLocalFrame()->loadRequest(request);
8815 8812
8816 // Normally, the result of the JS url replaces the existing contents on the 8813 // Normally, the result of the JS url replaces the existing contents on the
8817 // Document. However, if the JS triggers a navigation, the contents should 8814 // Document. However, if the JS triggers a navigation, the contents should
8818 // not be replaced. 8815 // not be replaced.
8819 EXPECT_EQ("", toLocalFrame(helper.webViewImpl()->page()->mainFrame())->docum ent()->documentElement()->innerText()); 8816 EXPECT_EQ("", toLocalFrame(helper.webViewImpl()->page()->mainFrame())->docum ent()->documentElement()->innerText());
8820 } 8817 }
8821 8818
8822 } // namespace blink 8819 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/tests/FrameTestHelpers.cpp ('k') | third_party/WebKit/Source/web/tests/WebURLRequestTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698