| 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 1281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1292 { | 1292 { |
| 1293 PrintWebViewClient client; | 1293 PrintWebViewClient client; |
| 1294 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("print_with_xhr_inflight.html")); | 1294 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("print_with_xhr_inflight.html")); |
| 1295 WebViewImpl* webViewImpl = m_webViewHelper.initializeAndLoad(m_baseURL + "pr
int_with_xhr_inflight.html", true, 0, &client); | 1295 WebViewImpl* webViewImpl = m_webViewHelper.initializeAndLoad(m_baseURL + "pr
int_with_xhr_inflight.html", true, 0, &client); |
| 1296 | 1296 |
| 1297 ASSERT_TRUE(toLocalFrame(webViewImpl->page()->mainFrame())->document()->load
EventFinished()); | 1297 ASSERT_TRUE(toLocalFrame(webViewImpl->page()->mainFrame())->document()->load
EventFinished()); |
| 1298 EXPECT_TRUE(client.printCalled()); | 1298 EXPECT_TRUE(client.printCalled()); |
| 1299 m_webViewHelper.reset(); | 1299 m_webViewHelper.reset(); |
| 1300 } | 1300 } |
| 1301 | 1301 |
| 1302 class DropTask : public WebThread::Task { | 1302 class DropTask : public WebTaskRunner::Task { |
| 1303 public: | 1303 public: |
| 1304 explicit DropTask(WebView* webView) : m_webView(webView) | 1304 explicit DropTask(WebView* webView) : m_webView(webView) |
| 1305 { | 1305 { |
| 1306 } | 1306 } |
| 1307 | 1307 |
| 1308 void run() override | 1308 void run() override |
| 1309 { | 1309 { |
| 1310 const WebPoint clientPoint(0, 0); | 1310 const WebPoint clientPoint(0, 0); |
| 1311 const WebPoint screenPoint(0, 0); | 1311 const WebPoint screenPoint(0, 0); |
| 1312 m_webView->dragTargetDrop(clientPoint, screenPoint, 0); | 1312 m_webView->dragTargetDrop(clientPoint, screenPoint, 0); |
| 1313 } | 1313 } |
| 1314 | 1314 |
| 1315 private: | 1315 private: |
| 1316 WebView* const m_webView; | 1316 WebView* const m_webView; |
| 1317 }; | 1317 }; |
| 1318 static void DragAndDropURL(WebViewImpl* webView, const std::string& url) | 1318 static void DragAndDropURL(WebViewImpl* webView, const std::string& url) |
| 1319 { | 1319 { |
| 1320 WebDragData dragData; | 1320 WebDragData dragData; |
| 1321 dragData.initialize(); | 1321 dragData.initialize(); |
| 1322 | 1322 |
| 1323 WebDragData::Item item; | 1323 WebDragData::Item item; |
| 1324 item.storageType = WebDragData::Item::StorageTypeString; | 1324 item.storageType = WebDragData::Item::StorageTypeString; |
| 1325 item.stringType = "text/uri-list"; | 1325 item.stringType = "text/uri-list"; |
| 1326 item.stringData = WebString::fromUTF8(url); | 1326 item.stringData = WebString::fromUTF8(url); |
| 1327 dragData.addItem(item); | 1327 dragData.addItem(item); |
| 1328 | 1328 |
| 1329 const WebPoint clientPoint(0, 0); | 1329 const WebPoint clientPoint(0, 0); |
| 1330 const WebPoint screenPoint(0, 0); | 1330 const WebPoint screenPoint(0, 0); |
| 1331 webView->dragTargetDragEnter(dragData, clientPoint, screenPoint, WebDragOper
ationCopy, 0); | 1331 webView->dragTargetDragEnter(dragData, clientPoint, screenPoint, WebDragOper
ationCopy, 0); |
| 1332 Platform::current()->currentThread()->postTask(FROM_HERE, new DropTask(webVi
ew)); | 1332 Platform::current()->currentThread()->taskRunner()->postTask(FROM_HERE, new
DropTask(webView)); |
| 1333 FrameTestHelpers::pumpPendingRequestsDoNotUse(webView->mainFrame()); | 1333 FrameTestHelpers::pumpPendingRequestsDoNotUse(webView->mainFrame()); |
| 1334 } | 1334 } |
| 1335 | 1335 |
| 1336 TEST_F(WebViewTest, DragDropURL) | 1336 TEST_F(WebViewTest, DragDropURL) |
| 1337 { | 1337 { |
| 1338 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), "foo.html"); | 1338 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), "foo.html"); |
| 1339 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), "bar.html"); | 1339 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), "bar.html"); |
| 1340 | 1340 |
| 1341 const std::string fooUrl = m_baseURL + "foo.html"; | 1341 const std::string fooUrl = m_baseURL + "foo.html"; |
| 1342 const std::string barUrl = m_baseURL + "bar.html"; | 1342 const std::string barUrl = m_baseURL + "bar.html"; |
| (...skipping 1718 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3061 WebFrame* frame = mainWebView.webView()->mainFrame(); | 3061 WebFrame* frame = mainWebView.webView()->mainFrame(); |
| 3062 v8::HandleScope scope(v8::Isolate::GetCurrent()); | 3062 v8::HandleScope scope(v8::Isolate::GetCurrent()); |
| 3063 v8::Local<v8::Value> v8Value = frame->executeScriptAndReturnValue(WebScriptS
ource("var win = window.open('javascript:false'); win.document")); | 3063 v8::Local<v8::Value> v8Value = frame->executeScriptAndReturnValue(WebScriptS
ource("var win = window.open('javascript:false'); win.document")); |
| 3064 ASSERT_TRUE(v8Value->IsObject()); | 3064 ASSERT_TRUE(v8Value->IsObject()); |
| 3065 Document* document = V8Document::toImplWithTypeCheck(v8::Isolate::GetCurrent
(), v8Value); | 3065 Document* document = V8Document::toImplWithTypeCheck(v8::Isolate::GetCurrent
(), v8Value); |
| 3066 ASSERT_TRUE(document); | 3066 ASSERT_TRUE(document); |
| 3067 EXPECT_FALSE(document->frame()->isLoading()); | 3067 EXPECT_FALSE(document->frame()->isLoading()); |
| 3068 } | 3068 } |
| 3069 | 3069 |
| 3070 } // namespace blink | 3070 } // namespace blink |
| OLD | NEW |