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

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

Issue 1141553006: Update Blink to use the tree scope info on WebFrame for scoping checks. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebase Created 5 years, 7 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 | Annotate | Revision Log
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 1444 matching lines...) Expand 10 before | Expand all | Expand 10 after
1455 runPendingTasks(); 1455 runPendingTasks();
1456 EXPECT_EQ(25, client.longpressX()); 1456 EXPECT_EQ(25, client.longpressX());
1457 EXPECT_EQ(7, client.longpressY()); 1457 EXPECT_EQ(7, client.longpressY());
1458 1458
1459 m_webViewHelper.reset(); // Explicitly reset to break dependency on locally scoped client. 1459 m_webViewHelper.reset(); // Explicitly reset to break dependency on locally scoped client.
1460 } 1460 }
1461 1461
1462 TEST_F(WebViewTest, ClientTapHandlingNullWebViewClient) 1462 TEST_F(WebViewTest, ClientTapHandlingNullWebViewClient)
1463 { 1463 {
1464 WebViewImpl* webView = WebViewImpl::create(nullptr); 1464 WebViewImpl* webView = WebViewImpl::create(nullptr);
1465 webView->setMainFrame(WebLocalFrame::create(nullptr)); 1465 webView->setMainFrame(WebLocalFrame::create(WebTreeScopeType::Document, null ptr));
1466 WebGestureEvent event; 1466 WebGestureEvent event;
1467 event.type = WebInputEvent::GestureTap; 1467 event.type = WebInputEvent::GestureTap;
1468 event.x = 3; 1468 event.x = 3;
1469 event.y = 8; 1469 event.y = 8;
1470 EXPECT_FALSE(webView->handleInputEvent(event)); 1470 EXPECT_FALSE(webView->handleInputEvent(event));
1471 webView->close(); 1471 webView->close();
1472 } 1472 }
1473 1473
1474 #if OS(ANDROID) 1474 #if OS(ANDROID)
1475 TEST_F(WebViewTest, LongPressSelection) 1475 TEST_F(WebViewTest, LongPressSelection)
(...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after
2044 webView->layout(); 2044 webView->layout();
2045 WebRect cropRect(0, 0, 100, 100); 2045 WebRect cropRect(0, 0, 100, 100);
2046 webView->extractSmartClipData(cropRect, clipText, clipHtml, clipRect); 2046 webView->extractSmartClipData(cropRect, clipText, clipHtml, clipRect);
2047 EXPECT_STREQ("", clipText.utf8().c_str()); 2047 EXPECT_STREQ("", clipText.utf8().c_str());
2048 EXPECT_STREQ("", clipHtml.utf8().c_str()); 2048 EXPECT_STREQ("", clipHtml.utf8().c_str());
2049 } 2049 }
2050 2050
2051 class CreateChildCounterFrameClient : public FrameTestHelpers::TestWebFrameClien t { 2051 class CreateChildCounterFrameClient : public FrameTestHelpers::TestWebFrameClien t {
2052 public: 2052 public:
2053 CreateChildCounterFrameClient() : m_count(0) { } 2053 CreateChildCounterFrameClient() : m_count(0) { }
2054 virtual WebFrame* createChildFrame(WebLocalFrame* parent, const WebString& f rameName, WebSandboxFlags) override; 2054 virtual WebFrame* createChildFrame(WebLocalFrame* parent, WebTreeScopeType, const WebString& frameName, WebSandboxFlags) override;
2055 2055
2056 int count() const { return m_count; } 2056 int count() const { return m_count; }
2057 2057
2058 private: 2058 private:
2059 int m_count; 2059 int m_count;
2060 }; 2060 };
2061 2061
2062 WebFrame* CreateChildCounterFrameClient::createChildFrame(WebLocalFrame* parent, const WebString& frameName, WebSandboxFlags sandboxFlags) 2062 WebFrame* CreateChildCounterFrameClient::createChildFrame(WebLocalFrame* parent, WebTreeScopeType scope, const WebString& frameName, WebSandboxFlags sandboxFlag s)
2063 { 2063 {
2064 ++m_count; 2064 ++m_count;
2065 return TestWebFrameClient::createChildFrame(parent, frameName, sandboxFlags) ; 2065 return TestWebFrameClient::createChildFrame(parent, scope, frameName, sandbo xFlags);
2066 } 2066 }
2067 2067
2068 TEST_F(WebViewTest, ChangeDisplayMode) 2068 TEST_F(WebViewTest, ChangeDisplayMode)
2069 { 2069 {
2070 WebView* webView = m_webViewHelper.initializeAndLoad("about:blank", true); 2070 WebView* webView = m_webViewHelper.initializeAndLoad("about:blank", true);
2071 2071
2072 WebScriptSource source("document.querySelector('body').innerHTML = window.ma tchMedia('(display-mode: minimal-ui)').matches"); 2072 WebScriptSource source("document.querySelector('body').innerHTML = window.ma tchMedia('(display-mode: minimal-ui)').matches");
2073 2073
2074 webView->mainFrame()->executeScript(source); 2074 webView->mainFrame()->executeScript(source);
2075 std::string content = webView->mainFrame()->contentAsText(5).utf8(); 2075 std::string content = webView->mainFrame()->contentAsText(5).utf8();
(...skipping 916 matching lines...) Expand 10 before | Expand all | Expand 10 after
2992 for (size_t i = 0; i < renders.size(); ++i) { 2992 for (size_t i = 0; i < renders.size(); ++i) {
2993 double docStartTime = frame->domWindow()->document()->loader()->timing() .monotonicTimeToZeroBasedDocumentTime(renderPairs[i].startTime) * 1000.0; 2993 double docStartTime = frame->domWindow()->document()->loader()->timing() .monotonicTimeToZeroBasedDocumentTime(renderPairs[i].startTime) * 1000.0;
2994 ASSERT_DOUBLE_EQ(docStartTime, renders[i]->startTime()); 2994 ASSERT_DOUBLE_EQ(docStartTime, renders[i]->startTime());
2995 double docFinishTime = frame->domWindow()->document()->loader()->timing( ).monotonicTimeToZeroBasedDocumentTime(renderPairs[i].finishTime) * 1000.0; 2995 double docFinishTime = frame->domWindow()->document()->loader()->timing( ).monotonicTimeToZeroBasedDocumentTime(renderPairs[i].finishTime) * 1000.0;
2996 double docDuration = docFinishTime - docStartTime; 2996 double docDuration = docFinishTime - docStartTime;
2997 ASSERT_DOUBLE_EQ(docDuration, renders[i]->duration()); 2997 ASSERT_DOUBLE_EQ(docDuration, renders[i]->duration());
2998 } 2998 }
2999 } 2999 }
3000 3000
3001 } // namespace 3001 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698