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

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

Issue 2787893004: Fixing select all for contenteditable (Closed)
Patch Set: rebase Created 3 years, 8 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
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 11549 matching lines...) Expand 10 before | Expand all | Expand 10 after
11560 webView->resize(WebSize(500, 300)); 11560 webView->resize(WebSize(500, 300));
11561 webView->updateAllLifecyclePhases(); 11561 webView->updateAllLifecyclePhases();
11562 runPendingTasks(); 11562 runPendingTasks();
11563 webView->setInitialFocus(false); 11563 webView->setInitialFocus(false);
11564 runPendingTasks(); 11564 runPendingTasks();
11565 11565
11566 WebMouseEvent mouseEvent(WebInputEvent::MouseDown, WebInputEvent::NoModifiers, 11566 WebMouseEvent mouseEvent(WebInputEvent::MouseDown, WebInputEvent::NoModifiers,
11567 WebInputEvent::TimeStampForTesting); 11567 WebInputEvent::TimeStampForTesting);
11568 11568
11569 mouseEvent.button = WebMouseEvent::Button::Right; 11569 mouseEvent.button = WebMouseEvent::Button::Right;
11570 mouseEvent.setPositionInWidget(10, 10); 11570 mouseEvent.setPositionInWidget(8, 8);
11571 mouseEvent.clickCount = 1; 11571 mouseEvent.clickCount = 1;
11572 webView->handleInputEvent(WebCoalescedInputEvent(mouseEvent)); 11572 webView->handleInputEvent(WebCoalescedInputEvent(mouseEvent));
11573 runPendingTasks(); 11573 runPendingTasks();
11574 webViewHelper.reset(); 11574 webViewHelper.reset();
11575 return frame.getMenuData().editFlags & WebContextMenuData::CanSelectAll; 11575 return frame.getMenuData().editFlags & WebContextMenuData::CanSelectAll;
11576 } 11576 }
11577 11577
11578 TEST_F(WebFrameTest, ContextMenuData) { 11578 TEST_F(WebFrameTest, ContextMenuData) {
11579 EXPECT_FALSE(testSelectAll("<textarea></textarea>")); 11579 EXPECT_FALSE(testSelectAll("<textarea></textarea>"));
11580 EXPECT_TRUE(testSelectAll("<textarea>nonempty</textarea>")); 11580 EXPECT_TRUE(testSelectAll("<textarea>nonempty</textarea>"));
11581 EXPECT_FALSE(testSelectAll("<input>")); 11581 EXPECT_FALSE(testSelectAll("<input>"));
11582 EXPECT_TRUE(testSelectAll("<input value='nonempty'>")); 11582 EXPECT_TRUE(testSelectAll("<input value='nonempty'>"));
11583 // TODO(amaralp): Empty contenteditable should not have select all enabled. 11583 EXPECT_FALSE(testSelectAll("<div contenteditable></div>"));
11584 EXPECT_TRUE(testSelectAll("<div contenteditable></div>"));
11585 EXPECT_TRUE(testSelectAll("<div contenteditable>nonempty</div>")); 11584 EXPECT_TRUE(testSelectAll("<div contenteditable>nonempty</div>"));
yosin_UTC9 2017/04/06 08:27:27 Could you add |EXPECT_TRUE(testSelectAll("<div con
amaralp 2017/04/06 21:51:21 Done.
11586 } 11585 }
11587 11586
11588 TEST_F(WebFrameTest, LocalFrameWithRemoteParentIsTransparent) { 11587 TEST_F(WebFrameTest, LocalFrameWithRemoteParentIsTransparent) {
11589 FrameTestHelpers::TestWebViewClient viewClient; 11588 FrameTestHelpers::TestWebViewClient viewClient;
11590 FrameTestHelpers::TestWebRemoteFrameClient remoteClient; 11589 FrameTestHelpers::TestWebRemoteFrameClient remoteClient;
11591 WebView* view = WebView::create(&viewClient, WebPageVisibilityStateVisible); 11590 WebView* view = WebView::create(&viewClient, WebPageVisibilityStateVisible);
11592 view->settings()->setJavaScriptEnabled(true); 11591 view->settings()->setJavaScriptEnabled(true);
11593 view->setMainFrame(remoteClient.frame()); 11592 view->setMainFrame(remoteClient.frame());
11594 WebRemoteFrame* root = view->mainFrame()->toWebRemoteFrame(); 11593 WebRemoteFrame* root = view->mainFrame()->toWebRemoteFrame();
11595 root->setReplicatedOrigin(SecurityOrigin::createUnique()); 11594 root->setReplicatedOrigin(SecurityOrigin::createUnique());
11596 11595
11597 WebLocalFrameImpl* localFrame = FrameTestHelpers::createLocalChild(root); 11596 WebLocalFrameImpl* localFrame = FrameTestHelpers::createLocalChild(root);
11598 FrameTestHelpers::loadFrame(localFrame, "data:text/html,some page"); 11597 FrameTestHelpers::loadFrame(localFrame, "data:text/html,some page");
11599 11598
11600 // Local frame with remote parent should have transparent baseBackgroundColor. 11599 // Local frame with remote parent should have transparent baseBackgroundColor.
11601 Color color = localFrame->frameView()->baseBackgroundColor(); 11600 Color color = localFrame->frameView()->baseBackgroundColor();
11602 EXPECT_EQ(Color::transparent, color); 11601 EXPECT_EQ(Color::transparent, color);
11603 11602
11604 view->close(); 11603 view->close();
11605 } 11604 }
11606 11605
11607 } // namespace blink 11606 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698