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

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: Created 4 years, 7 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 6109 matching lines...) Expand 10 before | Expand all | Expand 10 after
6120 { 6120 {
6121 registerMockedHttpURLLoad("foo_with_image.html"); 6121 registerMockedHttpURLLoad("foo_with_image.html");
6122 registerMockedHttpURLLoad("white-1x1.png"); 6122 registerMockedHttpURLLoad("white-1x1.png");
6123 TestSameDocumentWithImageWebFrameClient client; 6123 TestSameDocumentWithImageWebFrameClient client;
6124 FrameTestHelpers::WebViewHelper webViewHelper(this); 6124 FrameTestHelpers::WebViewHelper webViewHelper(this);
6125 webViewHelper.initializeAndLoad(m_baseURL + "foo_with_image.html", true, &cl ient, nullptr, nullptr, &configureLoadsImagesAutomatically); 6125 webViewHelper.initializeAndLoad(m_baseURL + "foo_with_image.html", true, &cl ient, nullptr, nullptr, &configureLoadsImagesAutomatically);
6126 6126
6127 WebCache::clear(); 6127 WebCache::clear();
6128 FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), m_baseURL + "foo_with_image.html"); 6128 FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), m_baseURL + "foo_with_image.html");
6129 6129
6130 EXPECT_EQ(client.numOfImageRequests(), 2); 6130 // 2 images are requested, and each triggers 2 willSendRequest() calls,
6131 // once for preloading and once for the real request.
6132 EXPECT_EQ(client.numOfImageRequests(), 4);
6131 } 6133 }
6132 6134
6133 TEST_P(ParameterizedWebFrameTest, WebNodeImageContents) 6135 TEST_P(ParameterizedWebFrameTest, WebNodeImageContents)
6134 { 6136 {
6135 FrameTestHelpers::WebViewHelper webViewHelper(this); 6137 FrameTestHelpers::WebViewHelper webViewHelper(this);
6136 webViewHelper.initializeAndLoad("about:blank", true); 6138 webViewHelper.initializeAndLoad("about:blank", true);
6137 WebFrame* frame = webViewHelper.webView()->mainFrame(); 6139 WebFrame* frame = webViewHelper.webView()->mainFrame();
6138 6140
6139 static const char bluePNG[] = "<img src=\"data:image/png;base64,iVBORw0KGgoA AAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAGElEQVQYV2NkYPj/n4EIwDiqEF8oUT94AFIQE/cCn90I AAAAAElFTkSuQmCC\">"; 6141 static const char bluePNG[] = "<img src=\"data:image/png;base64,iVBORw0KGgoA AAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAGElEQVQYV2NkYPj/n4EIwDiqEF8oUT94AFIQE/cCn90I AAAAAElFTkSuQmCC\">";
6140 6142
(...skipping 2541 matching lines...) Expand 10 before | Expand all | Expand 10 after
8682 WebLocalFrame* mainFrame = helper.webView()->mainFrame()->toWebLocalFrame(); 8684 WebLocalFrame* mainFrame = helper.webView()->mainFrame()->toWebLocalFrame();
8683 v8::HandleScope scope(v8::Isolate::GetCurrent()); 8685 v8::HandleScope scope(v8::Isolate::GetCurrent());
8684 mainFrame->executeScript(WebScriptSource("hello = 'world';")); 8686 mainFrame->executeScript(WebScriptSource("hello = 'world';"));
8685 FrameTestHelpers::loadFrame(mainFrame, "data:text/html,new page"); 8687 FrameTestHelpers::loadFrame(mainFrame, "data:text/html,new page");
8686 v8::Local<v8::Value> result = mainFrame->executeScriptAndReturnValue(WebScri ptSource("hello")); 8688 v8::Local<v8::Value> result = mainFrame->executeScriptAndReturnValue(WebScri ptSource("hello"));
8687 ASSERT_TRUE(result->IsString()); 8689 ASSERT_TRUE(result->IsString());
8688 EXPECT_EQ("world", toCoreString(result->ToString(mainFrame->mainWorldScriptC ontext()).ToLocalChecked())); 8690 EXPECT_EQ("world", toCoreString(result->ToString(mainFrame->mainWorldScriptC ontext()).ToLocalChecked()));
8689 } 8691 }
8690 8692
8691 } // namespace blink 8693 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698