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

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

Issue 1710403003: Clean up WebTaskRunner::Task subclasses in web/tests/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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/web/tests/WebFrameTest.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 1327 matching lines...) Expand 10 before | Expand all | Expand 10 after
1338 { 1338 {
1339 PrintWebViewClient client; 1339 PrintWebViewClient client;
1340 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c _str()), WebString::fromUTF8("print_with_xhr_inflight.html")); 1340 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c _str()), WebString::fromUTF8("print_with_xhr_inflight.html"));
1341 WebViewImpl* webViewImpl = m_webViewHelper.initializeAndLoad(m_baseURL + "pr int_with_xhr_inflight.html", true, 0, &client); 1341 WebViewImpl* webViewImpl = m_webViewHelper.initializeAndLoad(m_baseURL + "pr int_with_xhr_inflight.html", true, 0, &client);
1342 1342
1343 ASSERT_TRUE(toLocalFrame(webViewImpl->page()->mainFrame())->document()->load EventFinished()); 1343 ASSERT_TRUE(toLocalFrame(webViewImpl->page()->mainFrame())->document()->load EventFinished());
1344 EXPECT_TRUE(client.printCalled()); 1344 EXPECT_TRUE(client.printCalled());
1345 m_webViewHelper.reset(); 1345 m_webViewHelper.reset();
1346 } 1346 }
1347 1347
1348 class DropTask : public WebTaskRunner::Task { 1348 static void runDropTask(WebView* webView)
1349 public: 1349 {
1350 explicit DropTask(WebView* webView) : m_webView(webView) 1350 const WebPoint clientPoint(0, 0);
1351 { 1351 const WebPoint screenPoint(0, 0);
1352 } 1352 webView->dragTargetDrop(clientPoint, screenPoint, 0);
1353 }
1353 1354
1354 void run() override
1355 {
1356 const WebPoint clientPoint(0, 0);
1357 const WebPoint screenPoint(0, 0);
1358 m_webView->dragTargetDrop(clientPoint, screenPoint, 0);
1359 }
1360
1361 private:
1362 WebView* const m_webView;
1363 };
1364 static void DragAndDropURL(WebViewImpl* webView, const std::string& url) 1355 static void DragAndDropURL(WebViewImpl* webView, const std::string& url)
1365 { 1356 {
1366 WebDragData dragData; 1357 WebDragData dragData;
1367 dragData.initialize(); 1358 dragData.initialize();
1368 1359
1369 WebDragData::Item item; 1360 WebDragData::Item item;
1370 item.storageType = WebDragData::Item::StorageTypeString; 1361 item.storageType = WebDragData::Item::StorageTypeString;
1371 item.stringType = "text/uri-list"; 1362 item.stringType = "text/uri-list";
1372 item.stringData = WebString::fromUTF8(url); 1363 item.stringData = WebString::fromUTF8(url);
1373 dragData.addItem(item); 1364 dragData.addItem(item);
1374 1365
1375 const WebPoint clientPoint(0, 0); 1366 const WebPoint clientPoint(0, 0);
1376 const WebPoint screenPoint(0, 0); 1367 const WebPoint screenPoint(0, 0);
1377 webView->dragTargetDragEnter(dragData, clientPoint, screenPoint, WebDragOper ationCopy, 0); 1368 webView->dragTargetDragEnter(dragData, clientPoint, screenPoint, WebDragOper ationCopy, 0);
1378 Platform::current()->currentThread()->taskRunner()->postTask(BLINK_FROM_HERE , new DropTask(webView)); 1369 Platform::current()->currentThread()->taskRunner()->postTask(BLINK_FROM_HERE , bind(&runDropTask, webView));
1379 FrameTestHelpers::pumpPendingRequestsDoNotUse(webView->mainFrame()); 1370 FrameTestHelpers::pumpPendingRequestsDoNotUse(webView->mainFrame());
1380 } 1371 }
1381 1372
1382 TEST_F(WebViewTest, DragDropURL) 1373 TEST_F(WebViewTest, DragDropURL)
1383 { 1374 {
1384 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c _str()), "foo.html"); 1375 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c _str()), "foo.html");
1385 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c _str()), "bar.html"); 1376 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c _str()), "bar.html");
1386 1377
1387 const std::string fooUrl = m_baseURL + "foo.html"; 1378 const std::string fooUrl = m_baseURL + "foo.html";
1388 const std::string barUrl = m_baseURL + "bar.html"; 1379 const std::string barUrl = m_baseURL + "bar.html";
(...skipping 1853 matching lines...) Expand 10 before | Expand all | Expand 10 after
3242 frame->setAutofillClient(&client); 3233 frame->setAutofillClient(&client);
3243 webView->setInitialFocus(false); 3234 webView->setInitialFocus(false);
3244 3235
3245 EXPECT_TRUE(webView->confirmComposition(WebString::fromUTF8(std::string("hel lo").c_str()))); 3236 EXPECT_TRUE(webView->confirmComposition(WebString::fromUTF8(std::string("hel lo").c_str())));
3246 EXPECT_EQ(1, client.textChangesFromUserGesture()); 3237 EXPECT_EQ(1, client.textChangesFromUserGesture());
3247 EXPECT_FALSE(UserGestureIndicator::processingUserGesture()); 3238 EXPECT_FALSE(UserGestureIndicator::processingUserGesture());
3248 frame->setAutofillClient(0); 3239 frame->setAutofillClient(0);
3249 } 3240 }
3250 3241
3251 } // namespace blink 3242 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/tests/WebFrameTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698