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 1620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1631 | 1631 |
1632 WebKeyboardEvent keyEvent; | 1632 WebKeyboardEvent keyEvent; |
1633 keyEvent.type = WebInputEvent::RawKeyDown; | 1633 keyEvent.type = WebInputEvent::RawKeyDown; |
1634 webView->handleInputEvent(keyEvent); | 1634 webView->handleInputEvent(keyEvent); |
1635 keyEvent.type = WebInputEvent::KeyUp; | 1635 keyEvent.type = WebInputEvent::KeyUp; |
1636 webView->handleInputEvent(keyEvent); | 1636 webView->handleInputEvent(keyEvent); |
1637 EXPECT_FALSE(mainFrame->frame()->selection().isCaretBlinkingSuspended()); | 1637 EXPECT_FALSE(mainFrame->frame()->selection().isCaretBlinkingSuspended()); |
1638 } | 1638 } |
1639 #endif | 1639 #endif |
1640 | 1640 |
1641 TEST_F(WebViewTest, BlinkCaretOnClosingContextMenu) | |
1642 { | |
1643 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c _str()), WebString::fromUTF8("form.html")); | |
1644 WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "form.html" , true); | |
1645 | |
1646 webView->setInitialFocus(false); | |
1647 runPendingTasks(); | |
1648 | |
1649 // We suspend caret blinking when pressing with left button. | |
1650 WebMouseEvent mouseEvent; | |
1651 mouseEvent.button = WebMouseEvent::ButtonLeft; | |
1652 mouseEvent.x = 1; | |
1653 mouseEvent.y = 1; | |
1654 mouseEvent.clickCount = 1; | |
1655 mouseEvent.type = WebInputEvent::MouseDown; | |
aelias_OOO_until_Jul13
2015/11/25 03:48:46
Could you also send the MouseUp event for realism
Changwan Ryu
2015/11/26 00:01:47
Actually, MouseUp will be consumed by context menu
| |
1656 webView->handleInputEvent(mouseEvent); | |
1657 runPendingTasks(); | |
1658 | |
1659 WebLocalFrameImpl* mainFrame = toWebLocalFrameImpl(webView->mainFrame()); | |
1660 EXPECT_TRUE(mainFrame->frame()->selection().isCaretBlinkingSuspended()); | |
1661 | |
1662 // Caret blinking is still suspended after showing context menu. | |
1663 webView->showContextMenu(); | |
1664 EXPECT_TRUE(mainFrame->frame()->selection().isCaretBlinkingSuspended()); | |
1665 | |
1666 // Caret blinking will be resumed only after context menu is closed. | |
1667 webView->didCloseContextMenu(); | |
1668 | |
1669 EXPECT_FALSE(mainFrame->frame()->selection().isCaretBlinkingSuspended()); | |
1670 } | |
1671 | |
1641 TEST_F(WebViewTest, SelectionOnReadOnlyInput) | 1672 TEST_F(WebViewTest, SelectionOnReadOnlyInput) |
1642 { | 1673 { |
1643 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c _str()), WebString::fromUTF8("selection_readonly.html")); | 1674 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c _str()), WebString::fromUTF8("selection_readonly.html")); |
1644 WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "selection_ readonly.html", true); | 1675 WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "selection_ readonly.html", true); |
1645 webView->resize(WebSize(640, 480)); | 1676 webView->resize(WebSize(640, 480)); |
1646 webView->updateAllLifecyclePhases(); | 1677 webView->updateAllLifecyclePhases(); |
1647 runPendingTasks(); | 1678 runPendingTasks(); |
1648 | 1679 |
1649 std::string testWord = "This text should be selected."; | 1680 std::string testWord = "This text should be selected."; |
1650 | 1681 |
(...skipping 1490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3141 WebFrame* frame = mainWebView.webView()->mainFrame(); | 3172 WebFrame* frame = mainWebView.webView()->mainFrame(); |
3142 v8::HandleScope scope(v8::Isolate::GetCurrent()); | 3173 v8::HandleScope scope(v8::Isolate::GetCurrent()); |
3143 v8::Local<v8::Value> v8Value = frame->executeScriptAndReturnValue(WebScriptS ource("var win = window.open('javascript:false'); win.document")); | 3174 v8::Local<v8::Value> v8Value = frame->executeScriptAndReturnValue(WebScriptS ource("var win = window.open('javascript:false'); win.document")); |
3144 ASSERT_TRUE(v8Value->IsObject()); | 3175 ASSERT_TRUE(v8Value->IsObject()); |
3145 Document* document = V8Document::toImplWithTypeCheck(v8::Isolate::GetCurrent (), v8Value); | 3176 Document* document = V8Document::toImplWithTypeCheck(v8::Isolate::GetCurrent (), v8Value); |
3146 ASSERT_TRUE(document); | 3177 ASSERT_TRUE(document); |
3147 EXPECT_FALSE(document->frame()->isLoading()); | 3178 EXPECT_FALSE(document->frame()->isLoading()); |
3148 } | 3179 } |
3149 | 3180 |
3150 } // namespace blink | 3181 } // namespace blink |
OLD | NEW |