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

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

Issue 1273023002: Fix WebLocalFrame leaks in unit tests. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 4 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
« no previous file with comments | « 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 1483 matching lines...) Expand 10 before | Expand all | Expand 10 after
1494 runPendingTasks(); 1494 runPendingTasks();
1495 EXPECT_EQ(25, client.longpressX()); 1495 EXPECT_EQ(25, client.longpressX());
1496 EXPECT_EQ(7, client.longpressY()); 1496 EXPECT_EQ(7, client.longpressY());
1497 1497
1498 m_webViewHelper.reset(); // Explicitly reset to break dependency on locally scoped client. 1498 m_webViewHelper.reset(); // Explicitly reset to break dependency on locally scoped client.
1499 } 1499 }
1500 1500
1501 TEST_F(WebViewTest, ClientTapHandlingNullWebViewClient) 1501 TEST_F(WebViewTest, ClientTapHandlingNullWebViewClient)
1502 { 1502 {
1503 WebViewImpl* webView = WebViewImpl::create(nullptr); 1503 WebViewImpl* webView = WebViewImpl::create(nullptr);
1504 webView->setMainFrame(WebLocalFrame::create(WebTreeScopeType::Document, null ptr)); 1504 WebLocalFrame* localFrame = WebLocalFrame::create(WebTreeScopeType::Document , nullptr);
1505 webView->setMainFrame(localFrame);
1505 WebGestureEvent event; 1506 WebGestureEvent event;
1506 event.type = WebInputEvent::GestureTap; 1507 event.type = WebInputEvent::GestureTap;
1507 event.x = 3; 1508 event.x = 3;
1508 event.y = 8; 1509 event.y = 8;
1509 EXPECT_FALSE(webView->handleInputEvent(event)); 1510 EXPECT_FALSE(webView->handleInputEvent(event));
1510 webView->close(); 1511 webView->close();
1512 // Explicitly close as the frame as no frame client to do so on frameDetache d().
1513 localFrame->close();
1511 } 1514 }
1512 1515
1513 #if OS(ANDROID) 1516 #if OS(ANDROID)
1514 TEST_F(WebViewTest, LongPressSelection) 1517 TEST_F(WebViewTest, LongPressSelection)
1515 { 1518 {
1516 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c _str()), WebString::fromUTF8("longpress_selection.html")); 1519 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c _str()), WebString::fromUTF8("longpress_selection.html"));
1517 1520
1518 WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "longpress_ selection.html", true); 1521 WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "longpress_ selection.html", true);
1519 webView->resize(WebSize(500, 300)); 1522 webView->resize(WebSize(500, 300));
1520 webView->layout(); 1523 webView->layout();
(...skipping 1502 matching lines...) Expand 10 before | Expand all | Expand 10 after
3023 for (size_t i = 0; i < renders.size(); ++i) { 3026 for (size_t i = 0; i < renders.size(); ++i) {
3024 double docStartTime = frame->domWindow()->document()->loader()->timing() .monotonicTimeToZeroBasedDocumentTime(renderPairs[i].startTime) * 1000.0; 3027 double docStartTime = frame->domWindow()->document()->loader()->timing() .monotonicTimeToZeroBasedDocumentTime(renderPairs[i].startTime) * 1000.0;
3025 ASSERT_DOUBLE_EQ(docStartTime, renders[i]->startTime()); 3028 ASSERT_DOUBLE_EQ(docStartTime, renders[i]->startTime());
3026 double docFinishTime = frame->domWindow()->document()->loader()->timing( ).monotonicTimeToZeroBasedDocumentTime(renderPairs[i].finishTime) * 1000.0; 3029 double docFinishTime = frame->domWindow()->document()->loader()->timing( ).monotonicTimeToZeroBasedDocumentTime(renderPairs[i].finishTime) * 1000.0;
3027 double docDuration = docFinishTime - docStartTime; 3030 double docDuration = docFinishTime - docStartTime;
3028 ASSERT_DOUBLE_EQ(docDuration, renders[i]->duration()); 3031 ASSERT_DOUBLE_EQ(docDuration, renders[i]->duration());
3029 } 3032 }
3030 } 3033 }
3031 3034
3032 } // namespace blink 3035 } // namespace blink
OLDNEW
« no previous file with comments | « Source/web/tests/WebFrameTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698