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

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

Issue 1889973002: Refactoring starting a resource load (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix a browser_test Created 4 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
« no previous file with comments | « third_party/WebKit/Source/core/loader/PingLoader.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 6062 matching lines...) Expand 10 before | Expand all | Expand 10 after
6073 { 6073 {
6074 registerMockedHttpURLLoad("foo_with_image.html"); 6074 registerMockedHttpURLLoad("foo_with_image.html");
6075 registerMockedHttpURLLoad("white-1x1.png"); 6075 registerMockedHttpURLLoad("white-1x1.png");
6076 TestSameDocumentWithImageWebFrameClient client; 6076 TestSameDocumentWithImageWebFrameClient client;
6077 FrameTestHelpers::WebViewHelper webViewHelper(this); 6077 FrameTestHelpers::WebViewHelper webViewHelper(this);
6078 webViewHelper.initializeAndLoad(m_baseURL + "foo_with_image.html", true, &cl ient, nullptr, nullptr, &configureLoadsImagesAutomatically); 6078 webViewHelper.initializeAndLoad(m_baseURL + "foo_with_image.html", true, &cl ient, nullptr, nullptr, &configureLoadsImagesAutomatically);
6079 6079
6080 WebCache::clear(); 6080 WebCache::clear();
6081 FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), m_baseURL + "foo_with_image.html"); 6081 FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), m_baseURL + "foo_with_image.html");
6082 6082
6083 EXPECT_EQ(client.numOfImageRequests(), 2); 6083 // 2 images are requested, and each triggers 2 willSendRequest() calls,
6084 // once for preloading and once for the real request.
6085 EXPECT_EQ(client.numOfImageRequests(), 4);
6084 } 6086 }
6085 6087
6086 TEST_P(ParameterizedWebFrameTest, WebNodeImageContents) 6088 TEST_P(ParameterizedWebFrameTest, WebNodeImageContents)
6087 { 6089 {
6088 FrameTestHelpers::WebViewHelper webViewHelper(this); 6090 FrameTestHelpers::WebViewHelper webViewHelper(this);
6089 webViewHelper.initializeAndLoad("about:blank", true); 6091 webViewHelper.initializeAndLoad("about:blank", true);
6090 WebFrame* frame = webViewHelper.webView()->mainFrame(); 6092 WebFrame* frame = webViewHelper.webView()->mainFrame();
6091 6093
6092 static const char bluePNG[] = "<img src=\"data:image/png;base64,iVBORw0KGgoA AAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAGElEQVQYV2NkYPj/n4EIwDiqEF8oUT94AFIQE/cCn90I AAAAAElFTkSuQmCC\">"; 6094 static const char bluePNG[] = "<img src=\"data:image/png;base64,iVBORw0KGgoA AAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAGElEQVQYV2NkYPj/n4EIwDiqEF8oUT94AFIQE/cCn90I AAAAAElFTkSuQmCC\">";
6093 6095
(...skipping 2567 matching lines...) Expand 10 before | Expand all | Expand 10 after
8661 WebLocalFrame* mainFrame = helper.webView()->mainFrame()->toWebLocalFrame(); 8663 WebLocalFrame* mainFrame = helper.webView()->mainFrame()->toWebLocalFrame();
8662 v8::HandleScope scope(v8::Isolate::GetCurrent()); 8664 v8::HandleScope scope(v8::Isolate::GetCurrent());
8663 mainFrame->executeScript(WebScriptSource("hello = 'world';")); 8665 mainFrame->executeScript(WebScriptSource("hello = 'world';"));
8664 FrameTestHelpers::loadFrame(mainFrame, "data:text/html,new page"); 8666 FrameTestHelpers::loadFrame(mainFrame, "data:text/html,new page");
8665 v8::Local<v8::Value> result = mainFrame->executeScriptAndReturnValue(WebScri ptSource("hello")); 8667 v8::Local<v8::Value> result = mainFrame->executeScriptAndReturnValue(WebScri ptSource("hello"));
8666 ASSERT_TRUE(result->IsString()); 8668 ASSERT_TRUE(result->IsString());
8667 EXPECT_EQ("world", toCoreString(result->ToString(mainFrame->mainWorldScriptC ontext()).ToLocalChecked())); 8669 EXPECT_EQ("world", toCoreString(result->ToString(mainFrame->mainWorldScriptC ontext()).ToLocalChecked()));
8668 } 8670 }
8669 8671
8670 } // namespace blink 8672 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/loader/PingLoader.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698