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

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

Issue 1415123002: Avoid image resource leaks in frame-related unit tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove redundant #include Created 5 years, 1 month 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/web/tests/WebPageSerializerTest.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) 2011, 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2011, 2012 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 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 std::string m_baseURL; 245 std::string m_baseURL;
246 FrameTestHelpers::WebViewHelper m_webViewHelper; 246 FrameTestHelpers::WebViewHelper m_webViewHelper;
247 }; 247 };
248 248
249 TEST_F(WebViewTest, SaveImageAt) 249 TEST_F(WebViewTest, SaveImageAt)
250 { 250 {
251 SaveImageFromDataURLWebViewClient client; 251 SaveImageFromDataURLWebViewClient client;
252 252
253 std::string url = m_baseURL + "image-with-data-url.html"; 253 std::string url = m_baseURL + "image-with-data-url.html";
254 URLTestHelpers::registerMockedURLLoad(toKURL(url), "image-with-data-url.html "); 254 URLTestHelpers::registerMockedURLLoad(toKURL(url), "image-with-data-url.html ");
255 URLTestHelpers::registerMockedURLLoad(toKURL("http://test"), "white-1x1.png" );
255 WebViewImpl* webView = m_webViewHelper.initializeAndLoad(url, true, 0, &clie nt); 256 WebViewImpl* webView = m_webViewHelper.initializeAndLoad(url, true, 0, &clie nt);
256 webView->resize(WebSize(400, 400)); 257 webView->resize(WebSize(400, 400));
257 webView->layout(); 258 webView->layout();
258 259
259 client.reset(); 260 client.reset();
260 webView->saveImageAt(WebPoint(1, 1)); 261 webView->saveImageAt(WebPoint(1, 1));
261 EXPECT_EQ(WebString::fromUTF8("data:image/gif;base64" 262 EXPECT_EQ(WebString::fromUTF8("data:image/gif;base64"
262 ",R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs="), client.result()); 263 ",R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs="), client.result());
263 264
264 client.reset(); 265 client.reset();
(...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after
876 testInputMode(WebString("verbatim"), "input_mode_type_text_verbatim.html"); 877 testInputMode(WebString("verbatim"), "input_mode_type_text_verbatim.html");
877 testInputMode(WebString("verbatim"), "input_mode_type_search_verbatim.html") ; 878 testInputMode(WebString("verbatim"), "input_mode_type_search_verbatim.html") ;
878 testInputMode(WebString(), "input_mode_type_url_verbatim.html"); 879 testInputMode(WebString(), "input_mode_type_url_verbatim.html");
879 testInputMode(WebString("verbatim"), "input_mode_textarea_verbatim.html"); 880 testInputMode(WebString("verbatim"), "input_mode_textarea_verbatim.html");
880 } 881 }
881 882
882 TEST_F(WebViewTest, TextInputInfoWithReplacedElements) 883 TEST_F(WebViewTest, TextInputInfoWithReplacedElements)
883 { 884 {
884 std::string url = m_baseURL + "div_with_image.html"; 885 std::string url = m_baseURL + "div_with_image.html";
885 URLTestHelpers::registerMockedURLLoad(toKURL(url), "div_with_image.html"); 886 URLTestHelpers::registerMockedURLLoad(toKURL(url), "div_with_image.html");
887 URLTestHelpers::registerMockedURLLoad(toKURL("http://www.test.com/foo.png"), "white-1x1.png");
886 WebView* webView = m_webViewHelper.initializeAndLoad(url); 888 WebView* webView = m_webViewHelper.initializeAndLoad(url);
887 webView->setInitialFocus(false); 889 webView->setInitialFocus(false);
888 WebTextInputInfo info = webView->textInputInfo(); 890 WebTextInputInfo info = webView->textInputInfo();
889 891
890 EXPECT_EQ("foo\xef\xbf\xbc", info.value.utf8()); 892 EXPECT_EQ("foo\xef\xbf\xbc", info.value.utf8());
891 } 893 }
892 894
893 TEST_F(WebViewTest, SetEditableSelectionOffsetsAndTextInputInfo) 895 TEST_F(WebViewTest, SetEditableSelectionOffsetsAndTextInputInfo)
894 { 896 {
895 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c _str()), WebString::fromUTF8("input_field_populated.html")); 897 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c _str()), WebString::fromUTF8("input_field_populated.html"));
(...skipping 2205 matching lines...) Expand 10 before | Expand all | Expand 10 after
3101 WebFrame* frame = mainWebView.webView()->mainFrame(); 3103 WebFrame* frame = mainWebView.webView()->mainFrame();
3102 v8::HandleScope scope(v8::Isolate::GetCurrent()); 3104 v8::HandleScope scope(v8::Isolate::GetCurrent());
3103 v8::Local<v8::Value> v8Value = frame->executeScriptAndReturnValue(WebScriptS ource("var win = window.open('javascript:false'); win.document")); 3105 v8::Local<v8::Value> v8Value = frame->executeScriptAndReturnValue(WebScriptS ource("var win = window.open('javascript:false'); win.document"));
3104 ASSERT_TRUE(v8Value->IsObject()); 3106 ASSERT_TRUE(v8Value->IsObject());
3105 Document* document = V8Document::toImplWithTypeCheck(v8::Isolate::GetCurrent (), v8Value); 3107 Document* document = V8Document::toImplWithTypeCheck(v8::Isolate::GetCurrent (), v8Value);
3106 ASSERT_TRUE(document); 3108 ASSERT_TRUE(document);
3107 EXPECT_FALSE(document->frame()->isLoading()); 3109 EXPECT_FALSE(document->frame()->isLoading());
3108 } 3110 }
3109 3111
3110 } // namespace blink 3112 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/tests/WebPageSerializerTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698