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

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

Issue 1831423003: Audit test code callsites that need an explicit lifecycle update. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Clean up. Created 4 years, 8 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) 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 2211 matching lines...) Expand 10 before | Expand all | Expand 10 after
2222 { 2222 {
2223 ++m_count; 2223 ++m_count;
2224 return TestWebFrameClient::createChildFrame(parent, scope, name, uniqueName, sandboxFlags, frameOwnerProperties); 2224 return TestWebFrameClient::createChildFrame(parent, scope, name, uniqueName, sandboxFlags, frameOwnerProperties);
2225 } 2225 }
2226 2226
2227 TEST_F(WebViewTest, ChangeDisplayMode) 2227 TEST_F(WebViewTest, ChangeDisplayMode)
2228 { 2228 {
2229 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c _str()), WebString::fromUTF8("display_mode.html")); 2229 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c _str()), WebString::fromUTF8("display_mode.html"));
2230 WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "display_mo de.html", true); 2230 WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "display_mo de.html", true);
2231 2231
2232 std::string content = WebFrameContentDumper::dumpFrameTreeAsText(webView->ma inFrame()->toWebLocalFrame(), 21).utf8(); 2232 std::string content = WebFrameContentDumper::dumpWebViewAsText(webView, 21). utf8();
2233 EXPECT_EQ("regular-ui", content); 2233 EXPECT_EQ("regular-ui", content);
2234 2234
2235 webView->setDisplayMode(WebDisplayModeMinimalUi); 2235 webView->setDisplayMode(WebDisplayModeMinimalUi);
2236 content = WebFrameContentDumper::dumpFrameTreeAsText(webView->mainFrame()->t oWebLocalFrame(), 21).utf8(); 2236 content = WebFrameContentDumper::dumpWebViewAsText(webView, 21).utf8();
2237 EXPECT_EQ("minimal-ui", content); 2237 EXPECT_EQ("minimal-ui", content);
2238 m_webViewHelper.reset(); 2238 m_webViewHelper.reset();
2239 } 2239 }
2240 2240
2241 TEST_F(WebViewTest, AddFrameInCloseUnload) 2241 TEST_F(WebViewTest, AddFrameInCloseUnload)
2242 { 2242 {
2243 CreateChildCounterFrameClient frameClient; 2243 CreateChildCounterFrameClient frameClient;
2244 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c _str()), WebString::fromUTF8("add_frame_in_unload.html")); 2244 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c _str()), WebString::fromUTF8("add_frame_in_unload.html"));
2245 m_webViewHelper.initializeAndLoad(m_baseURL + "add_frame_in_unload.html", tr ue, &frameClient); 2245 m_webViewHelper.initializeAndLoad(m_baseURL + "add_frame_in_unload.html", tr ue, &frameClient);
2246 m_webViewHelper.reset(); 2246 m_webViewHelper.reset();
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after
2697 TEST_F(WebViewTest, CompareSelectAllToContentAsText) 2697 TEST_F(WebViewTest, CompareSelectAllToContentAsText)
2698 { 2698 {
2699 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c _str()), WebString::fromUTF8("longpress_selection.html")); 2699 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c _str()), WebString::fromUTF8("longpress_selection.html"));
2700 WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "longpress_ selection.html", true); 2700 WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "longpress_ selection.html", true);
2701 2701
2702 WebLocalFrameImpl* frame = toWebLocalFrameImpl(webView->mainFrame()); 2702 WebLocalFrameImpl* frame = toWebLocalFrameImpl(webView->mainFrame());
2703 frame->executeScript(WebScriptSource(WebString::fromUTF8("document.execComma nd('SelectAll', false, null)"))); 2703 frame->executeScript(WebScriptSource(WebString::fromUTF8("document.execComma nd('SelectAll', false, null)")));
2704 std::string actual = frame->selectionAsText().utf8(); 2704 std::string actual = frame->selectionAsText().utf8();
2705 2705
2706 const int kMaxOutputCharacters = 1024; 2706 const int kMaxOutputCharacters = 1024;
2707 std::string expected = WebFrameContentDumper::dumpFrameTreeAsText(frame, kMa xOutputCharacters).utf8(); 2707 std::string expected = WebFrameContentDumper::dumpWebViewAsText(webView, kMa xOutputCharacters).utf8();
2708 EXPECT_EQ(expected, actual); 2708 EXPECT_EQ(expected, actual);
2709 } 2709 }
2710 2710
2711 TEST_F(WebViewTest, AutoResizeSubtreeLayout) 2711 TEST_F(WebViewTest, AutoResizeSubtreeLayout)
2712 { 2712 {
2713 std::string url = m_baseURL + "subtree-layout.html"; 2713 std::string url = m_baseURL + "subtree-layout.html";
2714 URLTestHelpers::registerMockedURLLoad(toKURL(url), "subtree-layout.html"); 2714 URLTestHelpers::registerMockedURLLoad(toKURL(url), "subtree-layout.html");
2715 WebView* webView = m_webViewHelper.initialize(true); 2715 WebView* webView = m_webViewHelper.initialize(true);
2716 2716
2717 webView->enableAutoResizeMode(WebSize(200, 200), WebSize(200, 200)); 2717 webView->enableAutoResizeMode(WebSize(200, 200), WebSize(200, 200));
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after
3245 frame->setAutofillClient(&client); 3245 frame->setAutofillClient(&client);
3246 webView->setInitialFocus(false); 3246 webView->setInitialFocus(false);
3247 3247
3248 EXPECT_TRUE(webView->confirmComposition(WebString::fromUTF8(std::string("hel lo").c_str()))); 3248 EXPECT_TRUE(webView->confirmComposition(WebString::fromUTF8(std::string("hel lo").c_str())));
3249 EXPECT_EQ(1, client.textChangesFromUserGesture()); 3249 EXPECT_EQ(1, client.textChangesFromUserGesture());
3250 EXPECT_FALSE(UserGestureIndicator::processingUserGesture()); 3250 EXPECT_FALSE(UserGestureIndicator::processingUserGesture());
3251 frame->setAutofillClient(0); 3251 frame->setAutofillClient(0);
3252 } 3252 }
3253 3253
3254 } // namespace blink 3254 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/tests/WebFrameTest.cpp ('k') | third_party/WebKit/public/web/WebFrameContentDumper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698