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

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

Issue 2542693002: Use WTF::TimeTicks to represent timestamp in Platform/Core event types (Closed)
Patch Set: Add TimeTicks::{To,In}Seconds utility functions Created 4 years 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 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 1892 matching lines...) Expand 10 before | Expand all | Expand 10 after
1903 1903
1904 IntPoint hitPoint = IntPoint(30, 30); // button size is 100x100 1904 IntPoint hitPoint = IntPoint(30, 30); // button size is 100x100
1905 1905
1906 WebLocalFrameImpl* frame = webViewHelper.webView()->mainFrameImpl(); 1906 WebLocalFrameImpl* frame = webViewHelper.webView()->mainFrameImpl();
1907 Document* document = frame->frame()->document(); 1907 Document* document = frame->frame()->document();
1908 Element* element = document->getElementById("tap_button"); 1908 Element* element = document->getElementById("tap_button");
1909 1909
1910 ASSERT_NE(nullptr, element); 1910 ASSERT_NE(nullptr, element);
1911 EXPECT_EQ(String("oldValue"), element->innerText()); 1911 EXPECT_EQ(String("oldValue"), element->innerText());
1912 1912
1913 PlatformGestureEvent gestureEvent( 1913 PlatformGestureEvent gestureEvent(PlatformEvent::EventType::GestureTap,
1914 PlatformEvent::EventType::GestureTap, hitPoint, hitPoint, IntSize(0, 0), 1914 hitPoint, hitPoint, IntSize(0, 0),
1915 0, PlatformEvent::NoModifiers, PlatformGestureSourceTouchscreen); 1915 TimeTicks(), PlatformEvent::NoModifiers,
1916 PlatformGestureSourceTouchscreen);
1916 webViewHelper.webView() 1917 webViewHelper.webView()
1917 ->mainFrameImpl() 1918 ->mainFrameImpl()
1918 ->frame() 1919 ->frame()
1919 ->eventHandler() 1920 ->eventHandler()
1920 .handleGestureEvent(gestureEvent); 1921 .handleGestureEvent(gestureEvent);
1921 // when pressed, the button changes its own text to "updatedValue" 1922 // when pressed, the button changes its own text to "updatedValue"
1922 EXPECT_EQ(String("updatedValue"), element->innerText()); 1923 EXPECT_EQ(String("updatedValue"), element->innerText());
1923 } 1924 }
1924 1925
1925 TEST_F(WebFrameTest, FrameOwnerPropertiesMargin) { 1926 TEST_F(WebFrameTest, FrameOwnerPropertiesMargin) {
(...skipping 4882 matching lines...) Expand 10 before | Expand all | Expand 10 after
6808 webViewHelper.initializeAndLoad(m_baseURL + "fragment_middle_click.html", 6809 webViewHelper.initializeAndLoad(m_baseURL + "fragment_middle_click.html",
6809 true, &client); 6810 true, &client);
6810 6811
6811 Document* document = 6812 Document* document =
6812 toLocalFrame(webViewHelper.webView()->page()->mainFrame())->document(); 6813 toLocalFrame(webViewHelper.webView()->page()->mainFrame())->document();
6813 KURL destination = document->url(); 6814 KURL destination = document->url();
6814 destination.setFragmentIdentifier("test"); 6815 destination.setFragmentIdentifier("test");
6815 6816
6816 Event* event = MouseEvent::create( 6817 Event* event = MouseEvent::create(
6817 EventTypeNames::click, false, false, document->domWindow(), 0, 0, 0, 0, 0, 6818 EventTypeNames::click, false, false, document->domWindow(), 0, 0, 0, 0, 0,
6818 0, 0, PlatformEvent::NoModifiers, 1, 0, nullptr, 0, 6819 0, 0, PlatformEvent::NoModifiers, 1, 0, nullptr, TimeTicks(),
6819 PlatformMouseEvent::RealOrIndistinguishable, String(), nullptr); 6820 PlatformMouseEvent::RealOrIndistinguishable, String(), nullptr);
6820 FrameLoadRequest frameRequest(document, ResourceRequest(destination)); 6821 FrameLoadRequest frameRequest(document, ResourceRequest(destination));
6821 frameRequest.setTriggeringEvent(event); 6822 frameRequest.setTriggeringEvent(event);
6822 toLocalFrame(webViewHelper.webView()->page()->mainFrame()) 6823 toLocalFrame(webViewHelper.webView()->page()->mainFrame())
6823 ->loader() 6824 ->loader()
6824 .load(frameRequest); 6825 .load(frameRequest);
6825 } 6826 }
6826 6827
6827 class TestNewWindowWebViewClient : public FrameTestHelpers::TestWebViewClient { 6828 class TestNewWindowWebViewClient : public FrameTestHelpers::TestWebViewClient {
6828 public: 6829 public:
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
6863 webViewHelper.initializeAndLoad(m_baseURL + "ctrl_click.html", true, 6864 webViewHelper.initializeAndLoad(m_baseURL + "ctrl_click.html", true,
6864 &webFrameClient, &webViewClient); 6865 &webFrameClient, &webViewClient);
6865 6866
6866 Document* document = 6867 Document* document =
6867 toLocalFrame(webViewHelper.webView()->page()->mainFrame())->document(); 6868 toLocalFrame(webViewHelper.webView()->page()->mainFrame())->document();
6868 KURL destination = toKURL(m_baseURL + "hello_world.html"); 6869 KURL destination = toKURL(m_baseURL + "hello_world.html");
6869 6870
6870 // ctrl+click event 6871 // ctrl+click event
6871 Event* event = MouseEvent::create( 6872 Event* event = MouseEvent::create(
6872 EventTypeNames::click, false, false, document->domWindow(), 0, 0, 0, 0, 0, 6873 EventTypeNames::click, false, false, document->domWindow(), 0, 0, 0, 0, 0,
6873 0, 0, PlatformEvent::CtrlKey, 0, 0, nullptr, 0, 6874 0, 0, PlatformEvent::CtrlKey, 0, 0, nullptr, TimeTicks(),
6874 PlatformMouseEvent::RealOrIndistinguishable, String(), nullptr); 6875 PlatformMouseEvent::RealOrIndistinguishable, String(), nullptr);
6875 FrameLoadRequest frameRequest(document, ResourceRequest(destination)); 6876 FrameLoadRequest frameRequest(document, ResourceRequest(destination));
6876 frameRequest.setTriggeringEvent(event); 6877 frameRequest.setTriggeringEvent(event);
6877 UserGestureIndicator gesture(DocumentUserGestureToken::create(document)); 6878 UserGestureIndicator gesture(DocumentUserGestureToken::create(document));
6878 toLocalFrame(webViewHelper.webView()->page()->mainFrame()) 6879 toLocalFrame(webViewHelper.webView()->page()->mainFrame())
6879 ->loader() 6880 ->loader()
6880 .load(frameRequest); 6881 .load(frameRequest);
6881 FrameTestHelpers::pumpPendingRequestsForFrameToLoad( 6882 FrameTestHelpers::pumpPendingRequestsForFrameToLoad(
6882 webViewHelper.webView()->mainFrame()); 6883 webViewHelper.webView()->mainFrame());
6883 6884
(...skipping 3752 matching lines...) Expand 10 before | Expand all | Expand 10 after
10636 EXPECT_TRUE(hitTestResult.URLElement()); 10637 EXPECT_TRUE(hitTestResult.URLElement());
10637 EXPECT_TRUE(hitTestResult.innerElement()); 10638 EXPECT_TRUE(hitTestResult.innerElement());
10638 EXPECT_TRUE(hitTestResult.scrollbar()); 10639 EXPECT_TRUE(hitTestResult.scrollbar());
10639 EXPECT_FALSE(hitTestResult.scrollbar()->isCustomScrollbar()); 10640 EXPECT_FALSE(hitTestResult.scrollbar()->isCustomScrollbar());
10640 10641
10641 // Mouse over link. Mouse cursor should be hand. 10642 // Mouse over link. Mouse cursor should be hand.
10642 PlatformMouseEvent mouseMoveOverLinkEvent( 10643 PlatformMouseEvent mouseMoveOverLinkEvent(
10643 IntPoint(aTag->offsetLeft(), aTag->offsetTop()), 10644 IntPoint(aTag->offsetLeft(), aTag->offsetTop()),
10644 IntPoint(aTag->offsetLeft(), aTag->offsetTop()), 10645 IntPoint(aTag->offsetLeft(), aTag->offsetTop()),
10645 WebPointerProperties::Button::NoButton, PlatformEvent::MouseMoved, 0, 10646 WebPointerProperties::Button::NoButton, PlatformEvent::MouseMoved, 0,
10646 PlatformEvent::NoModifiers, WTF::monotonicallyIncreasingTime()); 10647 PlatformEvent::NoModifiers, TimeTicks::Now());
10647 document->frame()->eventHandler().handleMouseMoveEvent( 10648 document->frame()->eventHandler().handleMouseMoveEvent(
10648 mouseMoveOverLinkEvent, Vector<PlatformMouseEvent>()); 10649 mouseMoveOverLinkEvent, Vector<PlatformMouseEvent>());
10649 10650
10650 EXPECT_EQ( 10651 EXPECT_EQ(
10651 Cursor::Type::Hand, 10652 Cursor::Type::Hand,
10652 document->frame()->chromeClient().lastSetCursorForTesting().getType()); 10653 document->frame()->chromeClient().lastSetCursorForTesting().getType());
10653 10654
10654 // Mouse over enabled overlay scrollbar. Mouse cursor should be pointer and no 10655 // Mouse over enabled overlay scrollbar. Mouse cursor should be pointer and no
10655 // active hover element. 10656 // active hover element.
10656 PlatformMouseEvent mouseMoveEvent( 10657 PlatformMouseEvent mouseMoveEvent(
10657 IntPoint(18, aTag->offsetTop()), IntPoint(18, aTag->offsetTop()), 10658 IntPoint(18, aTag->offsetTop()), IntPoint(18, aTag->offsetTop()),
10658 WebPointerProperties::Button::NoButton, PlatformEvent::MouseMoved, 0, 10659 WebPointerProperties::Button::NoButton, PlatformEvent::MouseMoved, 0,
10659 PlatformEvent::NoModifiers, WTF::monotonicallyIncreasingTime()); 10660 PlatformEvent::NoModifiers, TimeTicks::Now());
10660 document->frame()->eventHandler().handleMouseMoveEvent( 10661 document->frame()->eventHandler().handleMouseMoveEvent(
10661 mouseMoveEvent, Vector<PlatformMouseEvent>()); 10662 mouseMoveEvent, Vector<PlatformMouseEvent>());
10662 10663
10663 EXPECT_EQ( 10664 EXPECT_EQ(
10664 Cursor::Type::Pointer, 10665 Cursor::Type::Pointer,
10665 document->frame()->chromeClient().lastSetCursorForTesting().getType()); 10666 document->frame()->chromeClient().lastSetCursorForTesting().getType());
10666 10667
10667 PlatformMouseEvent mousePressEvent( 10668 PlatformMouseEvent mousePressEvent(
10668 IntPoint(18, aTag->offsetTop()), IntPoint(18, aTag->offsetTop()), 10669 IntPoint(18, aTag->offsetTop()), IntPoint(18, aTag->offsetTop()),
10669 WebPointerProperties::Button::Left, PlatformEvent::MousePressed, 0, 10670 WebPointerProperties::Button::Left, PlatformEvent::MousePressed, 0,
10670 PlatformEvent::Modifiers::LeftButtonDown, 10671 PlatformEvent::Modifiers::LeftButtonDown, TimeTicks::Now());
10671 WTF::monotonicallyIncreasingTime());
10672 document->frame()->eventHandler().handleMousePressEvent(mousePressEvent); 10672 document->frame()->eventHandler().handleMousePressEvent(mousePressEvent);
10673 10673
10674 EXPECT_FALSE(document->activeHoverElement()); 10674 EXPECT_FALSE(document->activeHoverElement());
10675 EXPECT_FALSE(document->hoverNode()); 10675 EXPECT_FALSE(document->hoverNode());
10676 10676
10677 PlatformMouseEvent MouseReleaseEvent( 10677 PlatformMouseEvent MouseReleaseEvent(
10678 IntPoint(18, aTag->offsetTop()), IntPoint(18, aTag->offsetTop()), 10678 IntPoint(18, aTag->offsetTop()), IntPoint(18, aTag->offsetTop()),
10679 WebPointerProperties::Button::Left, PlatformEvent::MouseReleased, 0, 10679 WebPointerProperties::Button::Left, PlatformEvent::MouseReleased, 0,
10680 PlatformEvent::Modifiers::LeftButtonDown, 10680 PlatformEvent::Modifiers::LeftButtonDown, TimeTicks::Now());
10681 WTF::monotonicallyIncreasingTime());
10682 document->frame()->eventHandler().handleMouseReleaseEvent(MouseReleaseEvent); 10681 document->frame()->eventHandler().handleMouseReleaseEvent(MouseReleaseEvent);
10683 10682
10684 // Mouse over disabled overlay scrollbar. Mouse cursor should be hand and has 10683 // Mouse over disabled overlay scrollbar. Mouse cursor should be hand and has
10685 // active hover element. 10684 // active hover element.
10686 webView->mainFrameImpl()->frameView()->setScrollbarsHidden(true); 10685 webView->mainFrameImpl()->frameView()->setScrollbarsHidden(true);
10687 10686
10688 // Ensure hittest only has link 10687 // Ensure hittest only has link
10689 hitTestResult = webView->coreHitTestResultAt(WebPoint(18, aTag->offsetTop())); 10688 hitTestResult = webView->coreHitTestResultAt(WebPoint(18, aTag->offsetTop()));
10690 10689
10691 EXPECT_TRUE(hitTestResult.URLElement()); 10690 EXPECT_TRUE(hitTestResult.URLElement());
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
10727 // Ensure hittest only has DIV 10726 // Ensure hittest only has DIV
10728 HitTestResult hitTestResult = webView->coreHitTestResultAt(WebPoint(1, 1)); 10727 HitTestResult hitTestResult = webView->coreHitTestResultAt(WebPoint(1, 1));
10729 10728
10730 EXPECT_TRUE(hitTestResult.innerElement()); 10729 EXPECT_TRUE(hitTestResult.innerElement());
10731 EXPECT_FALSE(hitTestResult.scrollbar()); 10730 EXPECT_FALSE(hitTestResult.scrollbar());
10732 10731
10733 // Mouse over DIV 10732 // Mouse over DIV
10734 PlatformMouseEvent mouseMoveOverDiv( 10733 PlatformMouseEvent mouseMoveOverDiv(
10735 IntPoint(1, 1), IntPoint(1, 1), WebPointerProperties::Button::NoButton, 10734 IntPoint(1, 1), IntPoint(1, 1), WebPointerProperties::Button::NoButton,
10736 PlatformEvent::MouseMoved, 0, PlatformEvent::NoModifiers, 10735 PlatformEvent::MouseMoved, 0, PlatformEvent::NoModifiers,
10737 WTF::monotonicallyIncreasingTime()); 10736 TimeTicks::Now());
10738 document->frame()->eventHandler().handleMouseMoveEvent( 10737 document->frame()->eventHandler().handleMouseMoveEvent(
10739 mouseMoveOverDiv, Vector<PlatformMouseEvent>()); 10738 mouseMoveOverDiv, Vector<PlatformMouseEvent>());
10740 10739
10741 // DIV :hover 10740 // DIV :hover
10742 EXPECT_EQ(document->hoverNode(), scrollbarDiv); 10741 EXPECT_EQ(document->hoverNode(), scrollbarDiv);
10743 10742
10744 // Ensure hittest has DIV and scrollbar 10743 // Ensure hittest has DIV and scrollbar
10745 hitTestResult = webView->coreHitTestResultAt(WebPoint(175, 1)); 10744 hitTestResult = webView->coreHitTestResultAt(WebPoint(175, 1));
10746 10745
10747 EXPECT_TRUE(hitTestResult.innerElement()); 10746 EXPECT_TRUE(hitTestResult.innerElement());
10748 EXPECT_TRUE(hitTestResult.scrollbar()); 10747 EXPECT_TRUE(hitTestResult.scrollbar());
10749 EXPECT_TRUE(hitTestResult.scrollbar()->isCustomScrollbar()); 10748 EXPECT_TRUE(hitTestResult.scrollbar()->isCustomScrollbar());
10750 10749
10751 // Mouse over scrollbar 10750 // Mouse over scrollbar
10752 PlatformMouseEvent mouseMoveOverDivAndScrollbar( 10751 PlatformMouseEvent mouseMoveOverDivAndScrollbar(
10753 IntPoint(175, 1), IntPoint(175, 1), 10752 IntPoint(175, 1), IntPoint(175, 1),
10754 WebPointerProperties::Button::NoButton, PlatformEvent::MouseMoved, 0, 10753 WebPointerProperties::Button::NoButton, PlatformEvent::MouseMoved, 0,
10755 PlatformEvent::NoModifiers, WTF::monotonicallyIncreasingTime()); 10754 PlatformEvent::NoModifiers, TimeTicks::Now());
10756 document->frame()->eventHandler().handleMouseMoveEvent( 10755 document->frame()->eventHandler().handleMouseMoveEvent(
10757 mouseMoveOverDivAndScrollbar, Vector<PlatformMouseEvent>()); 10756 mouseMoveOverDivAndScrollbar, Vector<PlatformMouseEvent>());
10758 10757
10759 // Custom not change the DIV :hover 10758 // Custom not change the DIV :hover
10760 EXPECT_EQ(document->hoverNode(), scrollbarDiv); 10759 EXPECT_EQ(document->hoverNode(), scrollbarDiv);
10761 EXPECT_EQ(hitTestResult.scrollbar()->hoveredPart(), ScrollbarPart::ThumbPart); 10760 EXPECT_EQ(hitTestResult.scrollbar()->hoveredPart(), ScrollbarPart::ThumbPart);
10762 } 10761 }
10763 10762
10764 static void disableCompositing(WebSettings* settings) { 10763 static void disableCompositing(WebSettings* settings) {
10765 settings->setAcceleratedCompositingEnabled(false); 10764 settings->setAcceleratedCompositingEnabled(false);
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
10943 10942
10944 EXPECT_TRUE(mainFrameClient.childClient().didCallFrameDetached()); 10943 EXPECT_TRUE(mainFrameClient.childClient().didCallFrameDetached());
10945 EXPECT_TRUE(mainFrameClient.childClient().didCallDidStopLoading()); 10944 EXPECT_TRUE(mainFrameClient.childClient().didCallDidStopLoading());
10946 EXPECT_TRUE(mainFrameClient.childClient().didCallDidFinishDocumentLoad()); 10945 EXPECT_TRUE(mainFrameClient.childClient().didCallDidFinishDocumentLoad());
10947 EXPECT_TRUE(mainFrameClient.childClient().didCallDidHandleOnloadEvents()); 10946 EXPECT_TRUE(mainFrameClient.childClient().didCallDidHandleOnloadEvents());
10948 10947
10949 webViewHelper.reset(); 10948 webViewHelper.reset();
10950 } 10949 }
10951 10950
10952 } // namespace blink 10951 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698