Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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) |
|
dcheng
2016/02/22 05:02:28
This one as well.
| |
| 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 Loading... | |
| 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 |
| OLD | NEW |