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

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

Issue 2896563002: Update WebLocalFrameImpl with WebLocalFrameBase to break dependencies. (Closed)
Patch Set: Rebase Created 3 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
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 29 matching lines...) Expand all
40 #include "core/dom/NodeComputedStyle.h" 40 #include "core/dom/NodeComputedStyle.h"
41 #include "core/editing/FrameSelection.h" 41 #include "core/editing/FrameSelection.h"
42 #include "core/editing/InputMethodController.h" 42 #include "core/editing/InputMethodController.h"
43 #include "core/editing/markers/DocumentMarkerController.h" 43 #include "core/editing/markers/DocumentMarkerController.h"
44 #include "core/exported/WebViewBase.h" 44 #include "core/exported/WebViewBase.h"
45 #include "core/frame/EventHandlerRegistry.h" 45 #include "core/frame/EventHandlerRegistry.h"
46 #include "core/frame/FrameView.h" 46 #include "core/frame/FrameView.h"
47 #include "core/frame/LocalFrame.h" 47 #include "core/frame/LocalFrame.h"
48 #include "core/frame/Settings.h" 48 #include "core/frame/Settings.h"
49 #include "core/frame/VisualViewport.h" 49 #include "core/frame/VisualViewport.h"
50 #include "core/frame/WebLocalFrameBase.h"
50 #include "core/html/HTMLIFrameElement.h" 51 #include "core/html/HTMLIFrameElement.h"
51 #include "core/html/HTMLInputElement.h" 52 #include "core/html/HTMLInputElement.h"
52 #include "core/html/HTMLTextAreaElement.h" 53 #include "core/html/HTMLTextAreaElement.h"
53 #include "core/layout/api/LayoutViewItem.h" 54 #include "core/layout/api/LayoutViewItem.h"
54 #include "core/loader/DocumentLoader.h" 55 #include "core/loader/DocumentLoader.h"
55 #include "core/loader/FrameLoadRequest.h" 56 #include "core/loader/FrameLoadRequest.h"
56 #include "core/page/Page.h" 57 #include "core/page/Page.h"
57 #include "core/page/PrintContext.h" 58 #include "core/page/PrintContext.h"
58 #include "core/page/ScopedPageSuspender.h" 59 #include "core/page/ScopedPageSuspender.h"
59 #include "core/paint/PaintLayer.h" 60 #include "core/paint/PaintLayer.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 #include "public/web/WebSettings.h" 102 #include "public/web/WebSettings.h"
102 #include "public/web/WebTreeScopeType.h" 103 #include "public/web/WebTreeScopeType.h"
103 #include "public/web/WebViewClient.h" 104 #include "public/web/WebViewClient.h"
104 #include "public/web/WebWidget.h" 105 #include "public/web/WebWidget.h"
105 #include "public/web/WebWidgetClient.h" 106 #include "public/web/WebWidgetClient.h"
106 #include "testing/gtest/include/gtest/gtest.h" 107 #include "testing/gtest/include/gtest/gtest.h"
107 #include "third_party/skia/include/core/SkBitmap.h" 108 #include "third_party/skia/include/core/SkBitmap.h"
108 #include "third_party/skia/include/core/SkCanvas.h" 109 #include "third_party/skia/include/core/SkCanvas.h"
109 #include "web/DevToolsEmulator.h" 110 #include "web/DevToolsEmulator.h"
110 #include "web/WebInputMethodControllerImpl.h" 111 #include "web/WebInputMethodControllerImpl.h"
111 #include "web/WebLocalFrameImpl.h"
112 #include "web/WebSettingsImpl.h" 112 #include "web/WebSettingsImpl.h"
113 #include "web/tests/FrameTestHelpers.h" 113 #include "web/tests/FrameTestHelpers.h"
114 114
115 #if OS(MACOSX) 115 #if OS(MACOSX)
116 #include "public/web/mac/WebSubstringUtil.h" 116 #include "public/web/mac/WebSubstringUtil.h"
117 #endif 117 #endif
118 118
119 using blink::FrameTestHelpers::LoadFrame; 119 using blink::FrameTestHelpers::LoadFrame;
120 using blink::URLTestHelpers::ToKURL; 120 using blink::URLTestHelpers::ToKURL;
121 using blink::URLTestHelpers::RegisterMockedURLLoad; 121 using blink::URLTestHelpers::RegisterMockedURLLoad;
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
506 EXPECT_TRUE(GreenChannel(color)); 506 EXPECT_TRUE(GreenChannel(color));
507 } 507 }
508 508
509 TEST_P(WebViewTest, FocusIsInactive) { 509 TEST_P(WebViewTest, FocusIsInactive) {
510 RegisterMockedHttpURLLoad("visible_iframe.html"); 510 RegisterMockedHttpURLLoad("visible_iframe.html");
511 WebViewBase* web_view = 511 WebViewBase* web_view =
512 web_view_helper_.InitializeAndLoad(base_url_ + "visible_iframe.html"); 512 web_view_helper_.InitializeAndLoad(base_url_ + "visible_iframe.html");
513 513
514 web_view->SetFocus(true); 514 web_view->SetFocus(true);
515 web_view->SetIsActive(true); 515 web_view->SetIsActive(true);
516 WebLocalFrameImpl* frame = web_view->MainFrameImpl(); 516 WebLocalFrameBase* frame = web_view->MainFrameImpl();
517 EXPECT_TRUE(frame->GetFrame()->GetDocument()->IsHTMLDocument()); 517 EXPECT_TRUE(frame->GetFrame()->GetDocument()->IsHTMLDocument());
518 518
519 Document* document = frame->GetFrame()->GetDocument(); 519 Document* document = frame->GetFrame()->GetDocument();
520 EXPECT_TRUE(document->hasFocus()); 520 EXPECT_TRUE(document->hasFocus());
521 web_view->SetFocus(false); 521 web_view->SetFocus(false);
522 web_view->SetIsActive(false); 522 web_view->SetIsActive(false);
523 EXPECT_FALSE(document->hasFocus()); 523 EXPECT_FALSE(document->hasFocus());
524 web_view->SetFocus(true); 524 web_view->SetFocus(true);
525 web_view->SetIsActive(true); 525 web_view->SetIsActive(true);
526 EXPECT_TRUE(document->hasFocus()); 526 EXPECT_TRUE(document->hasFocus());
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
668 VerticalScrollbarState expected_vertical_state) { 668 VerticalScrollbarState expected_vertical_state) {
669 AutoResizeWebViewClient client; 669 AutoResizeWebViewClient client;
670 std::string url = 670 std::string url =
671 base_url_ + "specify_size.html?" + page_width + ":" + page_height; 671 base_url_ + "specify_size.html?" + page_width + ":" + page_height;
672 URLTestHelpers::RegisterMockedURLLoad( 672 URLTestHelpers::RegisterMockedURLLoad(
673 ToKURL(url), testing::WebTestDataPath("specify_size.html")); 673 ToKURL(url), testing::WebTestDataPath("specify_size.html"));
674 WebViewBase* web_view = 674 WebViewBase* web_view =
675 web_view_helper_.InitializeAndLoad(url, true, 0, &client); 675 web_view_helper_.InitializeAndLoad(url, true, 0, &client);
676 client.GetTestData().SetWebView(web_view); 676 client.GetTestData().SetWebView(web_view);
677 677
678 WebLocalFrameImpl* frame = web_view->MainFrameImpl(); 678 WebLocalFrameBase* frame = web_view->MainFrameImpl();
679 FrameView* frame_view = frame->GetFrame()->View(); 679 FrameView* frame_view = frame->GetFrame()->View();
680 frame_view->UpdateLayout(); 680 frame_view->UpdateLayout();
681 EXPECT_FALSE(frame_view->LayoutPending()); 681 EXPECT_FALSE(frame_view->LayoutPending());
682 EXPECT_FALSE(frame_view->NeedsLayout()); 682 EXPECT_FALSE(frame_view->NeedsLayout());
683 683
684 web_view->EnableAutoResizeMode(min_auto_resize, max_auto_resize); 684 web_view->EnableAutoResizeMode(min_auto_resize, max_auto_resize);
685 EXPECT_TRUE(frame_view->LayoutPending()); 685 EXPECT_TRUE(frame_view->LayoutPending());
686 EXPECT_TRUE(frame_view->NeedsLayout()); 686 EXPECT_TRUE(frame_view->NeedsLayout());
687 frame_view->UpdateLayout(); 687 frame_view->UpdateLayout();
688 688
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
775 TestAutoResize(min_auto_resize, max_auto_resize, page_width, page_height, 775 TestAutoResize(min_auto_resize, max_auto_resize, page_width, page_height,
776 expected_width, expected_height, kNoHorizontalScrollbar, 776 expected_width, expected_height, kNoHorizontalScrollbar,
777 kNoVerticalScrollbar); 777 kNoVerticalScrollbar);
778 } 778 }
779 779
780 void WebViewTest::TestTextInputType(WebTextInputType expected_type, 780 void WebViewTest::TestTextInputType(WebTextInputType expected_type,
781 const std::string& html_file) { 781 const std::string& html_file) {
782 RegisterMockedHttpURLLoad(html_file); 782 RegisterMockedHttpURLLoad(html_file);
783 WebViewBase* web_view = 783 WebViewBase* web_view =
784 web_view_helper_.InitializeAndLoad(base_url_ + html_file); 784 web_view_helper_.InitializeAndLoad(base_url_ + html_file);
785 WebInputMethodControllerImpl* controller = 785 WebInputMethodController* controller =
786 web_view->MainFrameImpl()->GetInputMethodController(); 786 web_view->MainFrameImpl()->GetInputMethodController();
787 EXPECT_EQ(kWebTextInputTypeNone, controller->TextInputType()); 787 EXPECT_EQ(kWebTextInputTypeNone, controller->TextInputType());
788 EXPECT_EQ(kWebTextInputTypeNone, controller->TextInputInfo().type); 788 EXPECT_EQ(kWebTextInputTypeNone, controller->TextInputInfo().type);
789 web_view->SetInitialFocus(false); 789 web_view->SetInitialFocus(false);
790 EXPECT_EQ(expected_type, controller->TextInputType()); 790 EXPECT_EQ(expected_type, controller->TextInputType());
791 EXPECT_EQ(expected_type, controller->TextInputInfo().type); 791 EXPECT_EQ(expected_type, controller->TextInputInfo().type);
792 web_view->ClearFocusedElement(); 792 web_view->ClearFocusedElement();
793 EXPECT_EQ(kWebTextInputTypeNone, controller->TextInputType()); 793 EXPECT_EQ(kWebTextInputTypeNone, controller->TextInputType());
794 EXPECT_EQ(kWebTextInputTypeNone, controller->TextInputInfo().type); 794 EXPECT_EQ(kWebTextInputTypeNone, controller->TextInputInfo().type);
795 } 795 }
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
901 ->TextInputInfo(); 901 ->TextInputInfo();
902 902
903 EXPECT_EQ("foo\xef\xbf\xbc", info.value.Utf8()); 903 EXPECT_EQ("foo\xef\xbf\xbc", info.value.Utf8());
904 } 904 }
905 905
906 TEST_P(WebViewTest, SetEditableSelectionOffsetsAndTextInputInfo) { 906 TEST_P(WebViewTest, SetEditableSelectionOffsetsAndTextInputInfo) {
907 RegisterMockedHttpURLLoad("input_field_populated.html"); 907 RegisterMockedHttpURLLoad("input_field_populated.html");
908 WebViewBase* web_view = web_view_helper_.InitializeAndLoad( 908 WebViewBase* web_view = web_view_helper_.InitializeAndLoad(
909 base_url_ + "input_field_populated.html"); 909 base_url_ + "input_field_populated.html");
910 web_view->SetInitialFocus(false); 910 web_view->SetInitialFocus(false);
911 WebLocalFrameImpl* frame = web_view->MainFrameImpl(); 911 WebLocalFrameBase* frame = web_view->MainFrameImpl();
912 WebInputMethodControllerImpl* active_input_method_controller = 912 WebInputMethodController* active_input_method_controller =
913 frame->GetInputMethodController(); 913 frame->GetInputMethodController();
914 frame->SetEditableSelectionOffsets(5, 13); 914 frame->SetEditableSelectionOffsets(5, 13);
915 EXPECT_EQ("56789abc", frame->SelectionAsText()); 915 EXPECT_EQ("56789abc", frame->SelectionAsText());
916 WebTextInputInfo info = active_input_method_controller->TextInputInfo(); 916 WebTextInputInfo info = active_input_method_controller->TextInputInfo();
917 EXPECT_EQ("0123456789abcdefghijklmnopqrstuvwxyz", info.value); 917 EXPECT_EQ("0123456789abcdefghijklmnopqrstuvwxyz", info.value);
918 EXPECT_EQ(5, info.selection_start); 918 EXPECT_EQ(5, info.selection_start);
919 EXPECT_EQ(13, info.selection_end); 919 EXPECT_EQ(13, info.selection_end);
920 EXPECT_EQ(-1, info.composition_start); 920 EXPECT_EQ(-1, info.composition_start);
921 EXPECT_EQ(-1, info.composition_end); 921 EXPECT_EQ(-1, info.composition_end);
922 922
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after
1324 RegisterMockedHttpURLLoad("form_with_input.html"); 1324 RegisterMockedHttpURLLoad("form_with_input.html");
1325 WebViewBase* web_view = 1325 WebViewBase* web_view =
1326 web_view_helper_.InitializeAndLoad(base_url_ + "form_with_input.html"); 1326 web_view_helper_.InitializeAndLoad(base_url_ + "form_with_input.html");
1327 web_view->Resize(WebSize(800, 600)); 1327 web_view->Resize(WebSize(800, 600));
1328 web_view->SetInitialFocus(false); 1328 web_view->SetInitialFocus(false);
1329 EXPECT_EQ(0, web_view->MainFrame()->GetScrollOffset().width); 1329 EXPECT_EQ(0, web_view->MainFrame()->GetScrollOffset().width);
1330 EXPECT_EQ(0, web_view->MainFrame()->GetScrollOffset().height); 1330 EXPECT_EQ(0, web_view->MainFrame()->GetScrollOffset().height);
1331 1331
1332 // Set up a composition from existing text that needs to be committed. 1332 // Set up a composition from existing text that needs to be committed.
1333 Vector<CompositionUnderline> empty_underlines; 1333 Vector<CompositionUnderline> empty_underlines;
1334 WebLocalFrameImpl* frame = web_view->MainFrameImpl(); 1334 WebLocalFrameBase* frame = web_view->MainFrameImpl();
1335 frame->GetFrame()->GetInputMethodController().SetCompositionFromExistingText( 1335 frame->GetFrame()->GetInputMethodController().SetCompositionFromExistingText(
1336 empty_underlines, 0, 3); 1336 empty_underlines, 0, 3);
1337 1337
1338 // Scroll the input field out of the viewport. 1338 // Scroll the input field out of the viewport.
1339 Element* element = static_cast<Element*>( 1339 Element* element = static_cast<Element*>(
1340 web_view->MainFrame()->GetDocument().GetElementById("btn")); 1340 web_view->MainFrame()->GetDocument().GetElementById("btn"));
1341 element->scrollIntoView(); 1341 element->scrollIntoView();
1342 float offset_height = web_view->MainFrame()->GetScrollOffset().height; 1342 float offset_height = web_view->MainFrame()->GetScrollOffset().height;
1343 EXPECT_EQ(0, web_view->MainFrame()->GetScrollOffset().width); 1343 EXPECT_EQ(0, web_view->MainFrame()->GetScrollOffset().width);
1344 EXPECT_LT(0, offset_height); 1344 EXPECT_LT(0, offset_height);
(...skipping 10 matching lines...) Expand all
1355 } 1355 }
1356 1356
1357 TEST_P(WebViewTest, InsertNewLinePlacementAfterFinishComposingText) { 1357 TEST_P(WebViewTest, InsertNewLinePlacementAfterFinishComposingText) {
1358 RegisterMockedHttpURLLoad("text_area_populated.html"); 1358 RegisterMockedHttpURLLoad("text_area_populated.html");
1359 WebViewBase* web_view = web_view_helper_.InitializeAndLoad( 1359 WebViewBase* web_view = web_view_helper_.InitializeAndLoad(
1360 base_url_ + "text_area_populated.html"); 1360 base_url_ + "text_area_populated.html");
1361 web_view->SetInitialFocus(false); 1361 web_view->SetInitialFocus(false);
1362 1362
1363 WebVector<WebCompositionUnderline> empty_underlines; 1363 WebVector<WebCompositionUnderline> empty_underlines;
1364 1364
1365 WebLocalFrameImpl* frame = web_view->MainFrameImpl(); 1365 WebLocalFrameBase* frame = web_view->MainFrameImpl();
1366 WebInputMethodController* active_input_method_controller = 1366 WebInputMethodController* active_input_method_controller =
1367 frame->GetInputMethodController(); 1367 frame->GetInputMethodController();
1368 frame->SetEditableSelectionOffsets(4, 4); 1368 frame->SetEditableSelectionOffsets(4, 4);
1369 frame->SetCompositionFromExistingText(8, 12, empty_underlines); 1369 frame->SetCompositionFromExistingText(8, 12, empty_underlines);
1370 1370
1371 WebTextInputInfo info = active_input_method_controller->TextInputInfo(); 1371 WebTextInputInfo info = active_input_method_controller->TextInputInfo();
1372 EXPECT_EQ("0123456789abcdefghijklmnopqrstuvwxyz", 1372 EXPECT_EQ("0123456789abcdefghijklmnopqrstuvwxyz",
1373 std::string(info.value.Utf8().data())); 1373 std::string(info.value.Utf8().data()));
1374 EXPECT_EQ(4, info.selection_start); 1374 EXPECT_EQ(4, info.selection_start);
1375 EXPECT_EQ(4, info.selection_end); 1375 EXPECT_EQ(4, info.selection_end);
(...skipping 18 matching lines...) Expand all
1394 EXPECT_EQ(-1, info.composition_start); 1394 EXPECT_EQ(-1, info.composition_start);
1395 EXPECT_EQ(-1, info.composition_end); 1395 EXPECT_EQ(-1, info.composition_end);
1396 EXPECT_EQ("0123\n456789abcdefghijklmnopqrstuvwxyz", 1396 EXPECT_EQ("0123\n456789abcdefghijklmnopqrstuvwxyz",
1397 std::string(info.value.Utf8().data())); 1397 std::string(info.value.Utf8().data()));
1398 } 1398 }
1399 1399
1400 TEST_P(WebViewTest, ExtendSelectionAndDelete) { 1400 TEST_P(WebViewTest, ExtendSelectionAndDelete) {
1401 RegisterMockedHttpURLLoad("input_field_populated.html"); 1401 RegisterMockedHttpURLLoad("input_field_populated.html");
1402 WebViewBase* web_view = web_view_helper_.InitializeAndLoad( 1402 WebViewBase* web_view = web_view_helper_.InitializeAndLoad(
1403 base_url_ + "input_field_populated.html"); 1403 base_url_ + "input_field_populated.html");
1404 WebLocalFrameImpl* frame = web_view->MainFrameImpl(); 1404 WebLocalFrameBase* frame = web_view->MainFrameImpl();
1405 web_view->SetInitialFocus(false); 1405 web_view->SetInitialFocus(false);
1406 frame->SetEditableSelectionOffsets(10, 10); 1406 frame->SetEditableSelectionOffsets(10, 10);
1407 frame->ExtendSelectionAndDelete(5, 8); 1407 frame->ExtendSelectionAndDelete(5, 8);
1408 WebInputMethodController* active_input_method_controller = 1408 WebInputMethodController* active_input_method_controller =
1409 frame->GetInputMethodController(); 1409 frame->GetInputMethodController();
1410 WebTextInputInfo info = active_input_method_controller->TextInputInfo(); 1410 WebTextInputInfo info = active_input_method_controller->TextInputInfo();
1411 EXPECT_EQ("01234ijklmnopqrstuvwxyz", std::string(info.value.Utf8().data())); 1411 EXPECT_EQ("01234ijklmnopqrstuvwxyz", std::string(info.value.Utf8().data()));
1412 EXPECT_EQ(5, info.selection_start); 1412 EXPECT_EQ(5, info.selection_start);
1413 EXPECT_EQ(5, info.selection_end); 1413 EXPECT_EQ(5, info.selection_end);
1414 frame->ExtendSelectionAndDelete(10, 0); 1414 frame->ExtendSelectionAndDelete(10, 0);
1415 info = active_input_method_controller->TextInputInfo(); 1415 info = active_input_method_controller->TextInputInfo();
1416 EXPECT_EQ("ijklmnopqrstuvwxyz", std::string(info.value.Utf8().data())); 1416 EXPECT_EQ("ijklmnopqrstuvwxyz", std::string(info.value.Utf8().data()));
1417 } 1417 }
1418 1418
1419 TEST_P(WebViewTest, DeleteSurroundingText) { 1419 TEST_P(WebViewTest, DeleteSurroundingText) {
1420 RegisterMockedHttpURLLoad("input_field_populated.html"); 1420 RegisterMockedHttpURLLoad("input_field_populated.html");
1421 WebView* web_view = web_view_helper_.InitializeAndLoad( 1421 WebView* web_view = web_view_helper_.InitializeAndLoad(
1422 base_url_ + "input_field_populated.html"); 1422 base_url_ + "input_field_populated.html");
1423 WebLocalFrameImpl* frame = ToWebLocalFrameImpl(web_view->MainFrame()); 1423 WebLocalFrameBase* frame = ToWebLocalFrameBase(web_view->MainFrame());
1424 WebInputMethodController* active_input_method_controller = 1424 WebInputMethodController* active_input_method_controller =
1425 frame->GetInputMethodController(); 1425 frame->GetInputMethodController();
1426 web_view->SetInitialFocus(false); 1426 web_view->SetInitialFocus(false);
1427 1427
1428 frame->SetEditableSelectionOffsets(10, 10); 1428 frame->SetEditableSelectionOffsets(10, 10);
1429 frame->DeleteSurroundingText(5, 8); 1429 frame->DeleteSurroundingText(5, 8);
1430 WebTextInputInfo info = active_input_method_controller->TextInputInfo(); 1430 WebTextInputInfo info = active_input_method_controller->TextInputInfo();
1431 EXPECT_EQ("01234ijklmnopqrstuvwxyz", std::string(info.value.Utf8().data())); 1431 EXPECT_EQ("01234ijklmnopqrstuvwxyz", std::string(info.value.Utf8().data()));
1432 EXPECT_EQ(5, info.selection_start); 1432 EXPECT_EQ(5, info.selection_start);
1433 EXPECT_EQ(5, info.selection_end); 1433 EXPECT_EQ(5, info.selection_end);
(...skipping 25 matching lines...) Expand all
1459 EXPECT_EQ(0, info.selection_end); 1459 EXPECT_EQ(0, info.selection_end);
1460 } 1460 }
1461 1461
1462 TEST_P(WebViewTest, SetCompositionFromExistingText) { 1462 TEST_P(WebViewTest, SetCompositionFromExistingText) {
1463 RegisterMockedHttpURLLoad("input_field_populated.html"); 1463 RegisterMockedHttpURLLoad("input_field_populated.html");
1464 WebViewBase* web_view = web_view_helper_.InitializeAndLoad( 1464 WebViewBase* web_view = web_view_helper_.InitializeAndLoad(
1465 base_url_ + "input_field_populated.html"); 1465 base_url_ + "input_field_populated.html");
1466 web_view->SetInitialFocus(false); 1466 web_view->SetInitialFocus(false);
1467 WebVector<WebCompositionUnderline> underlines(static_cast<size_t>(1)); 1467 WebVector<WebCompositionUnderline> underlines(static_cast<size_t>(1));
1468 underlines[0] = WebCompositionUnderline(0, 4, 0, false, 0); 1468 underlines[0] = WebCompositionUnderline(0, 4, 0, false, 0);
1469 WebLocalFrameImpl* frame = web_view->MainFrameImpl(); 1469 WebLocalFrameBase* frame = web_view->MainFrameImpl();
1470 WebInputMethodController* active_input_method_controller = 1470 WebInputMethodController* active_input_method_controller =
1471 frame->GetInputMethodController(); 1471 frame->GetInputMethodController();
1472 frame->SetEditableSelectionOffsets(4, 10); 1472 frame->SetEditableSelectionOffsets(4, 10);
1473 frame->SetCompositionFromExistingText(8, 12, underlines); 1473 frame->SetCompositionFromExistingText(8, 12, underlines);
1474 WebTextInputInfo info = active_input_method_controller->TextInputInfo(); 1474 WebTextInputInfo info = active_input_method_controller->TextInputInfo();
1475 EXPECT_EQ(4, info.selection_start); 1475 EXPECT_EQ(4, info.selection_start);
1476 EXPECT_EQ(10, info.selection_end); 1476 EXPECT_EQ(10, info.selection_end);
1477 EXPECT_EQ(8, info.composition_start); 1477 EXPECT_EQ(8, info.composition_start);
1478 EXPECT_EQ(12, info.composition_end); 1478 EXPECT_EQ(12, info.composition_end);
1479 WebVector<WebCompositionUnderline> empty_underlines; 1479 WebVector<WebCompositionUnderline> empty_underlines;
1480 frame->SetCompositionFromExistingText(0, 0, empty_underlines); 1480 frame->SetCompositionFromExistingText(0, 0, empty_underlines);
1481 info = active_input_method_controller->TextInputInfo(); 1481 info = active_input_method_controller->TextInputInfo();
1482 EXPECT_EQ(4, info.selection_start); 1482 EXPECT_EQ(4, info.selection_start);
1483 EXPECT_EQ(10, info.selection_end); 1483 EXPECT_EQ(10, info.selection_end);
1484 EXPECT_EQ(-1, info.composition_start); 1484 EXPECT_EQ(-1, info.composition_start);
1485 EXPECT_EQ(-1, info.composition_end); 1485 EXPECT_EQ(-1, info.composition_end);
1486 } 1486 }
1487 1487
1488 TEST_P(WebViewTest, SetCompositionFromExistingTextInTextArea) { 1488 TEST_P(WebViewTest, SetCompositionFromExistingTextInTextArea) {
1489 RegisterMockedHttpURLLoad("text_area_populated.html"); 1489 RegisterMockedHttpURLLoad("text_area_populated.html");
1490 WebViewBase* web_view = web_view_helper_.InitializeAndLoad( 1490 WebViewBase* web_view = web_view_helper_.InitializeAndLoad(
1491 base_url_ + "text_area_populated.html"); 1491 base_url_ + "text_area_populated.html");
1492 web_view->SetInitialFocus(false); 1492 web_view->SetInitialFocus(false);
1493 WebVector<WebCompositionUnderline> underlines(static_cast<size_t>(1)); 1493 WebVector<WebCompositionUnderline> underlines(static_cast<size_t>(1));
1494 underlines[0] = WebCompositionUnderline(0, 4, 0, false, 0); 1494 underlines[0] = WebCompositionUnderline(0, 4, 0, false, 0);
1495 WebLocalFrameImpl* frame = web_view->MainFrameImpl(); 1495 WebLocalFrameBase* frame = web_view->MainFrameImpl();
1496 WebInputMethodController* active_input_method_controller = 1496 WebInputMethodController* active_input_method_controller =
1497 frame->FrameWidget()->GetActiveWebInputMethodController(); 1497 frame->FrameWidget()->GetActiveWebInputMethodController();
1498 frame->SetEditableSelectionOffsets(27, 27); 1498 frame->SetEditableSelectionOffsets(27, 27);
1499 std::string new_line_text("\n"); 1499 std::string new_line_text("\n");
1500 WebVector<WebCompositionUnderline> empty_underlines; 1500 WebVector<WebCompositionUnderline> empty_underlines;
1501 active_input_method_controller->CommitText( 1501 active_input_method_controller->CommitText(
1502 WebString::FromUTF8(new_line_text.c_str()), empty_underlines, WebRange(), 1502 WebString::FromUTF8(new_line_text.c_str()), empty_underlines, WebRange(),
1503 0); 1503 0);
1504 WebTextInputInfo info = active_input_method_controller->TextInputInfo(); 1504 WebTextInputInfo info = active_input_method_controller->TextInputInfo();
1505 EXPECT_EQ("0123456789abcdefghijklmnopq\nrstuvwxyz", 1505 EXPECT_EQ("0123456789abcdefghijklmnopq\nrstuvwxyz",
(...skipping 22 matching lines...) Expand all
1528 EXPECT_EQ(-1, info.composition_end); 1528 EXPECT_EQ(-1, info.composition_end);
1529 } 1529 }
1530 1530
1531 TEST_P(WebViewTest, SetCompositionFromExistingTextInRichText) { 1531 TEST_P(WebViewTest, SetCompositionFromExistingTextInRichText) {
1532 RegisterMockedHttpURLLoad("content_editable_rich_text.html"); 1532 RegisterMockedHttpURLLoad("content_editable_rich_text.html");
1533 WebViewBase* web_view = web_view_helper_.InitializeAndLoad( 1533 WebViewBase* web_view = web_view_helper_.InitializeAndLoad(
1534 base_url_ + "content_editable_rich_text.html"); 1534 base_url_ + "content_editable_rich_text.html");
1535 web_view->SetInitialFocus(false); 1535 web_view->SetInitialFocus(false);
1536 WebVector<WebCompositionUnderline> underlines(static_cast<size_t>(1)); 1536 WebVector<WebCompositionUnderline> underlines(static_cast<size_t>(1));
1537 underlines[0] = WebCompositionUnderline(0, 4, 0, false, 0); 1537 underlines[0] = WebCompositionUnderline(0, 4, 0, false, 0);
1538 WebLocalFrameImpl* frame = web_view->MainFrameImpl(); 1538 WebLocalFrameBase* frame = web_view->MainFrameImpl();
1539 frame->SetEditableSelectionOffsets(1, 1); 1539 frame->SetEditableSelectionOffsets(1, 1);
1540 WebDocument document = web_view->MainFrame()->GetDocument(); 1540 WebDocument document = web_view->MainFrame()->GetDocument();
1541 EXPECT_FALSE(document.GetElementById("bold").IsNull()); 1541 EXPECT_FALSE(document.GetElementById("bold").IsNull());
1542 frame->SetCompositionFromExistingText(0, 4, underlines); 1542 frame->SetCompositionFromExistingText(0, 4, underlines);
1543 EXPECT_FALSE(document.GetElementById("bold").IsNull()); 1543 EXPECT_FALSE(document.GetElementById("bold").IsNull());
1544 } 1544 }
1545 1545
1546 TEST_P(WebViewTest, SetEditableSelectionOffsetsKeepsComposition) { 1546 TEST_P(WebViewTest, SetEditableSelectionOffsetsKeepsComposition) {
1547 RegisterMockedHttpURLLoad("input_field_populated.html"); 1547 RegisterMockedHttpURLLoad("input_field_populated.html");
1548 WebViewBase* web_view = web_view_helper_.InitializeAndLoad( 1548 WebViewBase* web_view = web_view_helper_.InitializeAndLoad(
(...skipping 14 matching lines...) Expand all
1563 WebString::FromUTF8(composition_text_second.c_str()), empty_underlines, 1563 WebString::FromUTF8(composition_text_second.c_str()), empty_underlines,
1564 WebRange(), 5, 5); 1564 WebRange(), 5, 5);
1565 1565
1566 WebTextInputInfo info = active_input_method_controller->TextInputInfo(); 1566 WebTextInputInfo info = active_input_method_controller->TextInputInfo();
1567 EXPECT_EQ("hello world", std::string(info.value.Utf8().data())); 1567 EXPECT_EQ("hello world", std::string(info.value.Utf8().data()));
1568 EXPECT_EQ(11, info.selection_start); 1568 EXPECT_EQ(11, info.selection_start);
1569 EXPECT_EQ(11, info.selection_end); 1569 EXPECT_EQ(11, info.selection_end);
1570 EXPECT_EQ(6, info.composition_start); 1570 EXPECT_EQ(6, info.composition_start);
1571 EXPECT_EQ(11, info.composition_end); 1571 EXPECT_EQ(11, info.composition_end);
1572 1572
1573 WebLocalFrameImpl* frame = web_view->MainFrameImpl(); 1573 WebLocalFrameBase* frame = web_view->MainFrameImpl();
1574 frame->SetEditableSelectionOffsets(6, 6); 1574 frame->SetEditableSelectionOffsets(6, 6);
1575 info = active_input_method_controller->TextInputInfo(); 1575 info = active_input_method_controller->TextInputInfo();
1576 EXPECT_EQ("hello world", std::string(info.value.Utf8().data())); 1576 EXPECT_EQ("hello world", std::string(info.value.Utf8().data()));
1577 EXPECT_EQ(6, info.selection_start); 1577 EXPECT_EQ(6, info.selection_start);
1578 EXPECT_EQ(6, info.selection_end); 1578 EXPECT_EQ(6, info.selection_end);
1579 EXPECT_EQ(6, info.composition_start); 1579 EXPECT_EQ(6, info.composition_start);
1580 EXPECT_EQ(11, info.composition_end); 1580 EXPECT_EQ(11, info.composition_end);
1581 1581
1582 frame->SetEditableSelectionOffsets(8, 8); 1582 frame->SetEditableSelectionOffsets(8, 8);
1583 info = active_input_method_controller->TextInputInfo(); 1583 info = active_input_method_controller->TextInputInfo();
(...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after
2284 web_view->Resize(WebSize(500, 500)); 2284 web_view->Resize(WebSize(500, 500));
2285 web_view->UpdateAllLifecyclePhases(); 2285 web_view->UpdateAllLifecyclePhases();
2286 RunPendingTasks(); 2286 RunPendingTasks();
2287 2287
2288 WebGestureEvent event(WebInputEvent::kGestureLongPress, 2288 WebGestureEvent event(WebInputEvent::kGestureLongPress,
2289 WebInputEvent::kNoModifiers, 2289 WebInputEvent::kNoModifiers,
2290 WebInputEvent::kTimeStampForTesting); 2290 WebInputEvent::kTimeStampForTesting);
2291 event.source_device = kWebGestureDeviceTouchscreen; 2291 event.source_device = kWebGestureDeviceTouchscreen;
2292 event.x = 300; 2292 event.x = 300;
2293 event.y = 300; 2293 event.y = 300;
2294 WebLocalFrameImpl* frame = web_view->MainFrameImpl(); 2294 WebLocalFrameBase* frame = web_view->MainFrameImpl();
2295 2295
2296 EXPECT_EQ(WebInputEventResult::kHandledSystem, 2296 EXPECT_EQ(WebInputEventResult::kHandledSystem,
2297 web_view->HandleInputEvent(WebCoalescedInputEvent(event))); 2297 web_view->HandleInputEvent(WebCoalescedInputEvent(event)));
2298 EXPECT_TRUE(frame->SelectionAsText().IsEmpty()); 2298 EXPECT_TRUE(frame->SelectionAsText().IsEmpty());
2299 } 2299 }
2300 2300
2301 TEST_P(WebViewTest, LongPressSelection) { 2301 TEST_P(WebViewTest, LongPressSelection) {
2302 RegisterMockedHttpURLLoad("longpress_selection.html"); 2302 RegisterMockedHttpURLLoad("longpress_selection.html");
2303 2303
2304 WebViewBase* web_view = web_view_helper_.InitializeAndLoad( 2304 WebViewBase* web_view = web_view_helper_.InitializeAndLoad(
2305 base_url_ + "longpress_selection.html", true); 2305 base_url_ + "longpress_selection.html", true);
2306 web_view->Resize(WebSize(500, 300)); 2306 web_view->Resize(WebSize(500, 300));
2307 web_view->UpdateAllLifecyclePhases(); 2307 web_view->UpdateAllLifecyclePhases();
2308 RunPendingTasks(); 2308 RunPendingTasks();
2309 2309
2310 WebString target = WebString::FromUTF8("target"); 2310 WebString target = WebString::FromUTF8("target");
2311 WebString onselectstartfalse = WebString::FromUTF8("onselectstartfalse"); 2311 WebString onselectstartfalse = WebString::FromUTF8("onselectstartfalse");
2312 WebLocalFrameImpl* frame = web_view->MainFrameImpl(); 2312 WebLocalFrameBase* frame = web_view->MainFrameImpl();
2313 2313
2314 EXPECT_TRUE( 2314 EXPECT_TRUE(
2315 TapElementById(WebInputEvent::kGestureLongPress, onselectstartfalse)); 2315 TapElementById(WebInputEvent::kGestureLongPress, onselectstartfalse));
2316 EXPECT_EQ("", std::string(frame->SelectionAsText().Utf8().data())); 2316 EXPECT_EQ("", std::string(frame->SelectionAsText().Utf8().data()));
2317 EXPECT_TRUE(TapElementById(WebInputEvent::kGestureLongPress, target)); 2317 EXPECT_TRUE(TapElementById(WebInputEvent::kGestureLongPress, target));
2318 EXPECT_EQ("testword", std::string(frame->SelectionAsText().Utf8().data())); 2318 EXPECT_EQ("testword", std::string(frame->SelectionAsText().Utf8().data()));
2319 } 2319 }
2320 2320
2321 TEST_P(WebViewTest, FinishComposingTextDoesNotDismissHandles) { 2321 TEST_P(WebViewTest, FinishComposingTextDoesNotDismissHandles) {
2322 RegisterMockedHttpURLLoad("longpress_selection.html"); 2322 RegisterMockedHttpURLLoad("longpress_selection.html");
2323 2323
2324 WebViewBase* web_view = web_view_helper_.InitializeAndLoad( 2324 WebViewBase* web_view = web_view_helper_.InitializeAndLoad(
2325 base_url_ + "longpress_selection.html", true); 2325 base_url_ + "longpress_selection.html", true);
2326 web_view->Resize(WebSize(500, 300)); 2326 web_view->Resize(WebSize(500, 300));
2327 web_view->UpdateAllLifecyclePhases(); 2327 web_view->UpdateAllLifecyclePhases();
2328 RunPendingTasks(); 2328 RunPendingTasks();
2329 2329
2330 WebString target = WebString::FromUTF8("target"); 2330 WebString target = WebString::FromUTF8("target");
2331 WebLocalFrameImpl* frame = web_view->MainFrameImpl(); 2331 WebLocalFrameBase* frame = web_view->MainFrameImpl();
2332 WebInputMethodController* active_input_method_controller = 2332 WebInputMethodController* active_input_method_controller =
2333 frame->FrameWidget()->GetActiveWebInputMethodController(); 2333 frame->FrameWidget()->GetActiveWebInputMethodController();
2334 EXPECT_TRUE(TapElementById(WebInputEvent::kGestureTap, target)); 2334 EXPECT_TRUE(TapElementById(WebInputEvent::kGestureTap, target));
2335 WebVector<WebCompositionUnderline> empty_underlines; 2335 WebVector<WebCompositionUnderline> empty_underlines;
2336 frame->SetEditableSelectionOffsets(8, 8); 2336 frame->SetEditableSelectionOffsets(8, 8);
2337 EXPECT_TRUE(active_input_method_controller->SetComposition( 2337 EXPECT_TRUE(active_input_method_controller->SetComposition(
2338 "12345", empty_underlines, WebRange(), 8, 13)); 2338 "12345", empty_underlines, WebRange(), 8, 13));
2339 EXPECT_TRUE(frame->GetFrame()->GetInputMethodController().HasComposition()); 2339 EXPECT_TRUE(frame->GetFrame()->GetInputMethodController().HasComposition());
2340 EXPECT_EQ("", std::string(frame->SelectionAsText().Utf8().data())); 2340 EXPECT_EQ("", std::string(frame->SelectionAsText().Utf8().data()));
2341 EXPECT_FALSE(frame->GetFrame()->Selection().IsHandleVisible()); 2341 EXPECT_FALSE(frame->GetFrame()->Selection().IsHandleVisible());
(...skipping 15 matching lines...) Expand all
2357 TEST_P(WebViewTest, TouchDoesntSelectEmptyTextarea) { 2357 TEST_P(WebViewTest, TouchDoesntSelectEmptyTextarea) {
2358 RegisterMockedHttpURLLoad("longpress_textarea.html"); 2358 RegisterMockedHttpURLLoad("longpress_textarea.html");
2359 2359
2360 WebViewBase* web_view = web_view_helper_.InitializeAndLoad( 2360 WebViewBase* web_view = web_view_helper_.InitializeAndLoad(
2361 base_url_ + "longpress_textarea.html", true); 2361 base_url_ + "longpress_textarea.html", true);
2362 web_view->Resize(WebSize(500, 300)); 2362 web_view->Resize(WebSize(500, 300));
2363 web_view->UpdateAllLifecyclePhases(); 2363 web_view->UpdateAllLifecyclePhases();
2364 RunPendingTasks(); 2364 RunPendingTasks();
2365 2365
2366 WebString blanklinestextbox = WebString::FromUTF8("blanklinestextbox"); 2366 WebString blanklinestextbox = WebString::FromUTF8("blanklinestextbox");
2367 WebLocalFrameImpl* frame = web_view->MainFrameImpl(); 2367 WebLocalFrameBase* frame = web_view->MainFrameImpl();
2368 2368
2369 // Long-press on carriage returns. 2369 // Long-press on carriage returns.
2370 EXPECT_TRUE( 2370 EXPECT_TRUE(
2371 TapElementById(WebInputEvent::kGestureLongPress, blanklinestextbox)); 2371 TapElementById(WebInputEvent::kGestureLongPress, blanklinestextbox));
2372 EXPECT_TRUE(frame->SelectionAsText().IsEmpty()); 2372 EXPECT_TRUE(frame->SelectionAsText().IsEmpty());
2373 2373
2374 // Double-tap on carriage returns. 2374 // Double-tap on carriage returns.
2375 WebGestureEvent event(WebInputEvent::kGestureTap, WebInputEvent::kNoModifiers, 2375 WebGestureEvent event(WebInputEvent::kGestureTap, WebInputEvent::kNoModifiers,
2376 WebInputEvent::kTimeStampForTesting); 2376 WebInputEvent::kTimeStampForTesting);
2377 event.source_device = kWebGestureDeviceTouchscreen; 2377 event.source_device = kWebGestureDeviceTouchscreen;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
2418 TEST_P(WebViewTest, BlinkCaretAfterLongPress) { 2418 TEST_P(WebViewTest, BlinkCaretAfterLongPress) {
2419 RegisterMockedHttpURLLoad("blink_caret_on_typing_after_long_press.html"); 2419 RegisterMockedHttpURLLoad("blink_caret_on_typing_after_long_press.html");
2420 2420
2421 WebViewBase* web_view = web_view_helper_.InitializeAndLoad( 2421 WebViewBase* web_view = web_view_helper_.InitializeAndLoad(
2422 base_url_ + "blink_caret_on_typing_after_long_press.html", true); 2422 base_url_ + "blink_caret_on_typing_after_long_press.html", true);
2423 web_view->Resize(WebSize(640, 480)); 2423 web_view->Resize(WebSize(640, 480));
2424 web_view->UpdateAllLifecyclePhases(); 2424 web_view->UpdateAllLifecyclePhases();
2425 RunPendingTasks(); 2425 RunPendingTasks();
2426 2426
2427 WebString target = WebString::FromUTF8("target"); 2427 WebString target = WebString::FromUTF8("target");
2428 WebLocalFrameImpl* main_frame = web_view->MainFrameImpl(); 2428 WebLocalFrameBase* main_frame = web_view->MainFrameImpl();
2429 2429
2430 EXPECT_TRUE(TapElementById(WebInputEvent::kGestureLongPress, target)); 2430 EXPECT_TRUE(TapElementById(WebInputEvent::kGestureLongPress, target));
2431 EXPECT_FALSE(main_frame->GetFrame()->Selection().IsCaretBlinkingSuspended()); 2431 EXPECT_FALSE(main_frame->GetFrame()->Selection().IsCaretBlinkingSuspended());
2432 } 2432 }
2433 2433
2434 TEST_P(WebViewTest, BlinkCaretOnClosingContextMenu) { 2434 TEST_P(WebViewTest, BlinkCaretOnClosingContextMenu) {
2435 RegisterMockedHttpURLLoad("form.html"); 2435 RegisterMockedHttpURLLoad("form.html");
2436 WebViewBase* web_view = 2436 WebViewBase* web_view =
2437 web_view_helper_.InitializeAndLoad(base_url_ + "form.html", true); 2437 web_view_helper_.InitializeAndLoad(base_url_ + "form.html", true);
2438 2438
2439 web_view->SetInitialFocus(false); 2439 web_view->SetInitialFocus(false);
2440 RunPendingTasks(); 2440 RunPendingTasks();
2441 2441
2442 // We suspend caret blinking when pressing with mouse right button. 2442 // We suspend caret blinking when pressing with mouse right button.
2443 // Note that we do not send MouseUp event here since it will be consumed 2443 // Note that we do not send MouseUp event here since it will be consumed
2444 // by the context menu once it shows up. 2444 // by the context menu once it shows up.
2445 WebMouseEvent mouse_event(WebInputEvent::kMouseDown, 2445 WebMouseEvent mouse_event(WebInputEvent::kMouseDown,
2446 WebInputEvent::kNoModifiers, 2446 WebInputEvent::kNoModifiers,
2447 WebInputEvent::kTimeStampForTesting); 2447 WebInputEvent::kTimeStampForTesting);
2448 2448
2449 mouse_event.button = WebMouseEvent::Button::kRight; 2449 mouse_event.button = WebMouseEvent::Button::kRight;
2450 mouse_event.SetPositionInWidget(1, 1); 2450 mouse_event.SetPositionInWidget(1, 1);
2451 mouse_event.click_count = 1; 2451 mouse_event.click_count = 1;
2452 web_view->HandleInputEvent(WebCoalescedInputEvent(mouse_event)); 2452 web_view->HandleInputEvent(WebCoalescedInputEvent(mouse_event));
2453 RunPendingTasks(); 2453 RunPendingTasks();
2454 2454
2455 WebLocalFrameImpl* main_frame = web_view->MainFrameImpl(); 2455 WebLocalFrameBase* main_frame = web_view->MainFrameImpl();
2456 EXPECT_TRUE(main_frame->GetFrame()->Selection().IsCaretBlinkingSuspended()); 2456 EXPECT_TRUE(main_frame->GetFrame()->Selection().IsCaretBlinkingSuspended());
2457 2457
2458 // Caret blinking is still suspended after showing context menu. 2458 // Caret blinking is still suspended after showing context menu.
2459 web_view->ShowContextMenu(); 2459 web_view->ShowContextMenu();
2460 EXPECT_TRUE(main_frame->GetFrame()->Selection().IsCaretBlinkingSuspended()); 2460 EXPECT_TRUE(main_frame->GetFrame()->Selection().IsCaretBlinkingSuspended());
2461 2461
2462 // Caret blinking will be resumed only after context menu is closed. 2462 // Caret blinking will be resumed only after context menu is closed.
2463 web_view->DidCloseContextMenu(); 2463 web_view->DidCloseContextMenu();
2464 2464
2465 EXPECT_FALSE(main_frame->GetFrame()->Selection().IsCaretBlinkingSuspended()); 2465 EXPECT_FALSE(main_frame->GetFrame()->Selection().IsCaretBlinkingSuspended());
2466 } 2466 }
2467 2467
2468 TEST_P(WebViewTest, SelectionOnReadOnlyInput) { 2468 TEST_P(WebViewTest, SelectionOnReadOnlyInput) {
2469 RegisterMockedHttpURLLoad("selection_readonly.html"); 2469 RegisterMockedHttpURLLoad("selection_readonly.html");
2470 WebViewBase* web_view = web_view_helper_.InitializeAndLoad( 2470 WebViewBase* web_view = web_view_helper_.InitializeAndLoad(
2471 base_url_ + "selection_readonly.html", true); 2471 base_url_ + "selection_readonly.html", true);
2472 web_view->Resize(WebSize(640, 480)); 2472 web_view->Resize(WebSize(640, 480));
2473 web_view->UpdateAllLifecyclePhases(); 2473 web_view->UpdateAllLifecyclePhases();
2474 RunPendingTasks(); 2474 RunPendingTasks();
2475 2475
2476 std::string test_word = "This text should be selected."; 2476 std::string test_word = "This text should be selected.";
2477 2477
2478 WebLocalFrameImpl* frame = web_view->MainFrameImpl(); 2478 WebLocalFrameBase* frame = web_view->MainFrameImpl();
2479 EXPECT_EQ(test_word, std::string(frame->SelectionAsText().Utf8().data())); 2479 EXPECT_EQ(test_word, std::string(frame->SelectionAsText().Utf8().data()));
2480 2480
2481 WebRange range = web_view->CaretOrSelectionRange(); 2481 WebRange range = web_view->CaretOrSelectionRange();
2482 EXPECT_FALSE(range.IsNull()); 2482 EXPECT_FALSE(range.IsNull());
2483 EXPECT_EQ(0, range.StartOffset()); 2483 EXPECT_EQ(0, range.StartOffset());
2484 EXPECT_EQ(static_cast<int>(test_word.length()), range.length()); 2484 EXPECT_EQ(static_cast<int>(test_word.length()), range.length());
2485 } 2485 }
2486 2486
2487 TEST_P(WebViewTest, KeyDownScrollsHandled) { 2487 TEST_P(WebViewTest, KeyDownScrollsHandled) {
2488 RegisterMockedHttpURLLoad("content-width-1000.html"); 2488 RegisterMockedHttpURLLoad("content-width-1000.html");
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
2643 int text_changes_; 2643 int text_changes_;
2644 int text_changes_from_user_gesture_; 2644 int text_changes_from_user_gesture_;
2645 int user_gesture_notifications_count_; 2645 int user_gesture_notifications_count_;
2646 }; 2646 };
2647 2647
2648 TEST_P(WebViewTest, LosingFocusDoesNotTriggerAutofillTextChange) { 2648 TEST_P(WebViewTest, LosingFocusDoesNotTriggerAutofillTextChange) {
2649 RegisterMockedHttpURLLoad("input_field_populated.html"); 2649 RegisterMockedHttpURLLoad("input_field_populated.html");
2650 MockAutofillClient client; 2650 MockAutofillClient client;
2651 WebViewBase* web_view = web_view_helper_.InitializeAndLoad( 2651 WebViewBase* web_view = web_view_helper_.InitializeAndLoad(
2652 base_url_ + "input_field_populated.html"); 2652 base_url_ + "input_field_populated.html");
2653 WebLocalFrameImpl* frame = web_view->MainFrameImpl(); 2653 WebLocalFrameBase* frame = web_view->MainFrameImpl();
2654 frame->SetAutofillClient(&client); 2654 frame->SetAutofillClient(&client);
2655 web_view->SetInitialFocus(false); 2655 web_view->SetInitialFocus(false);
2656 2656
2657 // Set up a composition that needs to be committed. 2657 // Set up a composition that needs to be committed.
2658 WebVector<WebCompositionUnderline> empty_underlines; 2658 WebVector<WebCompositionUnderline> empty_underlines;
2659 frame->SetEditableSelectionOffsets(4, 10); 2659 frame->SetEditableSelectionOffsets(4, 10);
2660 frame->SetCompositionFromExistingText(8, 12, empty_underlines); 2660 frame->SetCompositionFromExistingText(8, 12, empty_underlines);
2661 WebTextInputInfo info = frame->GetInputMethodController()->TextInputInfo(); 2661 WebTextInputInfo info = frame->GetInputMethodController()->TextInputInfo();
2662 EXPECT_EQ(4, info.selection_start); 2662 EXPECT_EQ(4, info.selection_start);
2663 EXPECT_EQ(10, info.selection_end); 2663 EXPECT_EQ(10, info.selection_end);
(...skipping 21 matching lines...) Expand all
2685 EXPECT_EQ(selection_end, info.selection_end) << fail_message; 2685 EXPECT_EQ(selection_end, info.selection_end) << fail_message;
2686 EXPECT_EQ(composition_start, info.composition_start) << fail_message; 2686 EXPECT_EQ(composition_start, info.composition_start) << fail_message;
2687 EXPECT_EQ(composition_end, info.composition_end) << fail_message; 2687 EXPECT_EQ(composition_end, info.composition_end) << fail_message;
2688 } 2688 }
2689 2689
2690 TEST_P(WebViewTest, CompositionNotCancelledByBackspace) { 2690 TEST_P(WebViewTest, CompositionNotCancelledByBackspace) {
2691 RegisterMockedHttpURLLoad("composition_not_cancelled_by_backspace.html"); 2691 RegisterMockedHttpURLLoad("composition_not_cancelled_by_backspace.html");
2692 MockAutofillClient client; 2692 MockAutofillClient client;
2693 WebViewBase* web_view = web_view_helper_.InitializeAndLoad( 2693 WebViewBase* web_view = web_view_helper_.InitializeAndLoad(
2694 base_url_ + "composition_not_cancelled_by_backspace.html"); 2694 base_url_ + "composition_not_cancelled_by_backspace.html");
2695 WebLocalFrameImpl* frame = web_view->MainFrameImpl(); 2695 WebLocalFrameBase* frame = web_view->MainFrameImpl();
2696 frame->SetAutofillClient(&client); 2696 frame->SetAutofillClient(&client);
2697 web_view->SetInitialFocus(false); 2697 web_view->SetInitialFocus(false);
2698 2698
2699 // Test both input elements. 2699 // Test both input elements.
2700 for (int i = 0; i < 2; ++i) { 2700 for (int i = 0; i < 2; ++i) {
2701 // Select composition and do sanity check. 2701 // Select composition and do sanity check.
2702 WebVector<WebCompositionUnderline> empty_underlines; 2702 WebVector<WebCompositionUnderline> empty_underlines;
2703 frame->SetEditableSelectionOffsets(6, 6); 2703 frame->SetEditableSelectionOffsets(6, 6);
2704 WebInputMethodController* active_input_method_controller = 2704 WebInputMethodController* active_input_method_controller =
2705 frame->FrameWidget()->GetActiveWebInputMethodController(); 2705 frame->FrameWidget()->GetActiveWebInputMethodController();
(...skipping 25 matching lines...) Expand all
2731 } 2731 }
2732 2732
2733 frame->SetAutofillClient(0); 2733 frame->SetAutofillClient(0);
2734 } 2734 }
2735 2735
2736 TEST_P(WebViewTest, FinishComposingTextDoesntTriggerAutofillTextChange) { 2736 TEST_P(WebViewTest, FinishComposingTextDoesntTriggerAutofillTextChange) {
2737 RegisterMockedHttpURLLoad("input_field_populated.html"); 2737 RegisterMockedHttpURLLoad("input_field_populated.html");
2738 MockAutofillClient client; 2738 MockAutofillClient client;
2739 WebViewBase* web_view = web_view_helper_.InitializeAndLoad( 2739 WebViewBase* web_view = web_view_helper_.InitializeAndLoad(
2740 base_url_ + "input_field_populated.html"); 2740 base_url_ + "input_field_populated.html");
2741 WebLocalFrameImpl* frame = web_view->MainFrameImpl(); 2741 WebLocalFrameBase* frame = web_view->MainFrameImpl();
2742 frame->SetAutofillClient(&client); 2742 frame->SetAutofillClient(&client);
2743 web_view->SetInitialFocus(false); 2743 web_view->SetInitialFocus(false);
2744 2744
2745 WebDocument document = web_view->MainFrame()->GetDocument(); 2745 WebDocument document = web_view->MainFrame()->GetDocument();
2746 HTMLFormControlElement* form = 2746 HTMLFormControlElement* form =
2747 ToHTMLFormControlElement(document.GetElementById("sample")); 2747 ToHTMLFormControlElement(document.GetElementById("sample"));
2748 2748
2749 WebInputMethodController* active_input_method_controller = 2749 WebInputMethodController* active_input_method_controller =
2750 frame->FrameWidget()->GetActiveWebInputMethodController(); 2750 frame->FrameWidget()->GetActiveWebInputMethodController();
2751 // Set up a composition that needs to be committed. 2751 // Set up a composition that needs to be committed.
(...skipping 21 matching lines...) Expand all
2773 2773
2774 frame->SetAutofillClient(0); 2774 frame->SetAutofillClient(0);
2775 } 2775 }
2776 2776
2777 TEST_P(WebViewTest, 2777 TEST_P(WebViewTest,
2778 SetCompositionFromExistingTextDoesntTriggerAutofillTextChange) { 2778 SetCompositionFromExistingTextDoesntTriggerAutofillTextChange) {
2779 RegisterMockedHttpURLLoad("input_field_populated.html"); 2779 RegisterMockedHttpURLLoad("input_field_populated.html");
2780 MockAutofillClient client; 2780 MockAutofillClient client;
2781 WebViewBase* web_view = web_view_helper_.InitializeAndLoad( 2781 WebViewBase* web_view = web_view_helper_.InitializeAndLoad(
2782 base_url_ + "input_field_populated.html", true); 2782 base_url_ + "input_field_populated.html", true);
2783 WebLocalFrameImpl* frame = web_view->MainFrameImpl(); 2783 WebLocalFrameBase* frame = web_view->MainFrameImpl();
2784 frame->SetAutofillClient(&client); 2784 frame->SetAutofillClient(&client);
2785 web_view->SetInitialFocus(false); 2785 web_view->SetInitialFocus(false);
2786 2786
2787 WebVector<WebCompositionUnderline> empty_underlines; 2787 WebVector<WebCompositionUnderline> empty_underlines;
2788 2788
2789 client.ClearChangeCounts(); 2789 client.ClearChangeCounts();
2790 frame->SetCompositionFromExistingText(8, 12, empty_underlines); 2790 frame->SetCompositionFromExistingText(8, 12, empty_underlines);
2791 2791
2792 WebTextInputInfo info = frame->GetInputMethodController()->TextInputInfo(); 2792 WebTextInputInfo info = frame->GetInputMethodController()->TextInputInfo();
2793 EXPECT_EQ("0123456789abcdefghijklmnopqrstuvwxyz", 2793 EXPECT_EQ("0123456789abcdefghijklmnopqrstuvwxyz",
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
2836 2836
2837 WebURL base_url = URLTestHelpers::ToKURL("http://example.com/"); 2837 WebURL base_url = URLTestHelpers::ToKURL("http://example.com/");
2838 FrameTestHelpers::LoadHTMLString( 2838 FrameTestHelpers::LoadHTMLString(
2839 web_view_impl->MainFrame(), 2839 web_view_impl->MainFrame(),
2840 "<html><body><iframe src=\"about:blank\"></iframe></body></html>", 2840 "<html><body><iframe src=\"about:blank\"></iframe></body></html>",
2841 base_url); 2841 base_url);
2842 2842
2843 // Make a request from a local frame. 2843 // Make a request from a local frame.
2844 WebURLRequest web_url_request_with_target_start; 2844 WebURLRequest web_url_request_with_target_start;
2845 LocalFrame* local_frame = 2845 LocalFrame* local_frame =
2846 ToWebLocalFrameImpl(web_view_impl->MainFrame()->FirstChild())->GetFrame(); 2846 ToWebLocalFrameBase(web_view_impl->MainFrame()->FirstChild())->GetFrame();
2847 FrameLoadRequest request_with_target_start( 2847 FrameLoadRequest request_with_target_start(
2848 local_frame->GetDocument(), 2848 local_frame->GetDocument(),
2849 web_url_request_with_target_start.ToResourceRequest(), "_top"); 2849 web_url_request_with_target_start.ToResourceRequest(), "_top");
2850 local_frame->Loader().Load(request_with_target_start); 2850 local_frame->Loader().Load(request_with_target_start);
2851 EXPECT_FALSE(client.DidFocusCalled()); 2851 EXPECT_FALSE(client.DidFocusCalled());
2852 2852
2853 web_view_helper.Reset(); // Remove dependency on locally scoped client. 2853 web_view_helper.Reset(); // Remove dependency on locally scoped client.
2854 } 2854 }
2855 2855
2856 TEST_P(WebViewTest, FocusExistingFrameOnNavigate) { 2856 TEST_P(WebViewTest, FocusExistingFrameOnNavigate) {
2857 ViewCreatingWebViewClient client; 2857 ViewCreatingWebViewClient client;
2858 FrameTestHelpers::WebViewHelper web_view_helper; 2858 FrameTestHelpers::WebViewHelper web_view_helper;
2859 WebViewBase* web_view_impl = web_view_helper.Initialize(true, 0, &client); 2859 WebViewBase* web_view_impl = web_view_helper.Initialize(true, 0, &client);
2860 WebLocalFrameImpl* frame = web_view_impl->MainFrameImpl(); 2860 WebLocalFrameBase* frame = web_view_impl->MainFrameImpl();
2861 frame->SetName("_start"); 2861 frame->SetName("_start");
2862 2862
2863 // Make a request that will open a new window 2863 // Make a request that will open a new window
2864 WebURLRequest web_url_request; 2864 WebURLRequest web_url_request;
2865 FrameLoadRequest request(0, web_url_request.ToResourceRequest(), "_blank"); 2865 FrameLoadRequest request(0, web_url_request.ToResourceRequest(), "_blank");
2866 ToLocalFrame(web_view_impl->GetPage()->MainFrame())->Loader().Load(request); 2866 ToLocalFrame(web_view_impl->GetPage()->MainFrame())->Loader().Load(request);
2867 ASSERT_TRUE(client.CreatedWebView()); 2867 ASSERT_TRUE(client.CreatedWebView());
2868 EXPECT_FALSE(client.DidFocusCalled()); 2868 EXPECT_FALSE(client.DidFocusCalled());
2869 2869
2870 // Make a request from the new window that will navigate the original window. 2870 // Make a request from the new window that will navigate the original window.
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after
3402 3402
3403 EXPECT_FALSE(registry.HasEventHandlers(EventHandlerRegistry::kScrollEvent)); 3403 EXPECT_FALSE(registry.HasEventHandlers(EventHandlerRegistry::kScrollEvent));
3404 } 3404 }
3405 3405
3406 // This test verifies the text input flags are correctly exposed to script. 3406 // This test verifies the text input flags are correctly exposed to script.
3407 TEST_P(WebViewTest, TextInputFlags) { 3407 TEST_P(WebViewTest, TextInputFlags) {
3408 std::string url = RegisterMockedHttpURLLoad("text_input_flags.html"); 3408 std::string url = RegisterMockedHttpURLLoad("text_input_flags.html");
3409 WebViewBase* web_view_impl = web_view_helper_.InitializeAndLoad(url, true); 3409 WebViewBase* web_view_impl = web_view_helper_.InitializeAndLoad(url, true);
3410 web_view_impl->SetInitialFocus(false); 3410 web_view_impl->SetInitialFocus(false);
3411 3411
3412 WebLocalFrameImpl* frame = web_view_impl->MainFrameImpl(); 3412 WebLocalFrameBase* frame = web_view_impl->MainFrameImpl();
3413 WebInputMethodControllerImpl* active_input_method_controller = 3413 WebInputMethodController* active_input_method_controller =
3414 frame->GetInputMethodController(); 3414 frame->GetInputMethodController();
3415 Document* document = frame->GetFrame()->GetDocument(); 3415 Document* document = frame->GetFrame()->GetDocument();
3416 3416
3417 // (A) <input> 3417 // (A) <input>
3418 // (A.1) Verifies autocorrect/autocomplete/spellcheck flags are Off and 3418 // (A.1) Verifies autocorrect/autocomplete/spellcheck flags are Off and
3419 // autocapitalize is set to none. 3419 // autocapitalize is set to none.
3420 HTMLInputElement* input_element = 3420 HTMLInputElement* input_element =
3421 toHTMLInputElement(document->getElementById("input")); 3421 toHTMLInputElement(document->getElementById("input"));
3422 document->SetFocusedElement( 3422 document->SetFocusedElement(
3423 input_element, 3423 input_element,
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
3461 web_view_helper_.Reset(); 3461 web_view_helper_.Reset();
3462 } 3462 }
3463 3463
3464 // Check that the WebAutofillClient is correctly notified about first user 3464 // Check that the WebAutofillClient is correctly notified about first user
3465 // gestures after load, following various input events. 3465 // gestures after load, following various input events.
3466 TEST_P(WebViewTest, FirstUserGestureObservedKeyEvent) { 3466 TEST_P(WebViewTest, FirstUserGestureObservedKeyEvent) {
3467 RegisterMockedHttpURLLoad("form.html"); 3467 RegisterMockedHttpURLLoad("form.html");
3468 MockAutofillClient client; 3468 MockAutofillClient client;
3469 WebViewBase* web_view = 3469 WebViewBase* web_view =
3470 web_view_helper_.InitializeAndLoad(base_url_ + "form.html", true); 3470 web_view_helper_.InitializeAndLoad(base_url_ + "form.html", true);
3471 WebLocalFrameImpl* frame = web_view->MainFrameImpl(); 3471 WebLocalFrameBase* frame = web_view->MainFrameImpl();
3472 frame->SetAutofillClient(&client); 3472 frame->SetAutofillClient(&client);
3473 web_view->SetInitialFocus(false); 3473 web_view->SetInitialFocus(false);
3474 3474
3475 EXPECT_EQ(0, client.GetUserGestureNotificationsCount()); 3475 EXPECT_EQ(0, client.GetUserGestureNotificationsCount());
3476 3476
3477 WebKeyboardEvent key_event(WebInputEvent::kRawKeyDown, 3477 WebKeyboardEvent key_event(WebInputEvent::kRawKeyDown,
3478 WebInputEvent::kNoModifiers, 3478 WebInputEvent::kNoModifiers,
3479 WebInputEvent::kTimeStampForTesting); 3479 WebInputEvent::kTimeStampForTesting);
3480 key_event.dom_key = Platform::Current()->DomKeyEnumFromString(" "); 3480 key_event.dom_key = Platform::Current()->DomKeyEnumFromString(" ");
3481 key_event.windows_key_code = VKEY_SPACE; 3481 key_event.windows_key_code = VKEY_SPACE;
3482 web_view->HandleInputEvent(WebCoalescedInputEvent(key_event)); 3482 web_view->HandleInputEvent(WebCoalescedInputEvent(key_event));
3483 key_event.SetType(WebInputEvent::kKeyUp); 3483 key_event.SetType(WebInputEvent::kKeyUp);
3484 web_view->HandleInputEvent(WebCoalescedInputEvent(key_event)); 3484 web_view->HandleInputEvent(WebCoalescedInputEvent(key_event));
3485 3485
3486 EXPECT_EQ(2, client.GetUserGestureNotificationsCount()); 3486 EXPECT_EQ(2, client.GetUserGestureNotificationsCount());
3487 frame->SetAutofillClient(0); 3487 frame->SetAutofillClient(0);
3488 } 3488 }
3489 3489
3490 TEST_P(WebViewTest, FirstUserGestureObservedMouseEvent) { 3490 TEST_P(WebViewTest, FirstUserGestureObservedMouseEvent) {
3491 RegisterMockedHttpURLLoad("form.html"); 3491 RegisterMockedHttpURLLoad("form.html");
3492 MockAutofillClient client; 3492 MockAutofillClient client;
3493 WebViewBase* web_view = 3493 WebViewBase* web_view =
3494 web_view_helper_.InitializeAndLoad(base_url_ + "form.html", true); 3494 web_view_helper_.InitializeAndLoad(base_url_ + "form.html", true);
3495 WebLocalFrameImpl* frame = web_view->MainFrameImpl(); 3495 WebLocalFrameBase* frame = web_view->MainFrameImpl();
3496 frame->SetAutofillClient(&client); 3496 frame->SetAutofillClient(&client);
3497 web_view->SetInitialFocus(false); 3497 web_view->SetInitialFocus(false);
3498 3498
3499 EXPECT_EQ(0, client.GetUserGestureNotificationsCount()); 3499 EXPECT_EQ(0, client.GetUserGestureNotificationsCount());
3500 3500
3501 WebMouseEvent mouse_event(WebInputEvent::kMouseDown, 3501 WebMouseEvent mouse_event(WebInputEvent::kMouseDown,
3502 WebInputEvent::kNoModifiers, 3502 WebInputEvent::kNoModifiers,
3503 WebInputEvent::kTimeStampForTesting); 3503 WebInputEvent::kTimeStampForTesting);
3504 mouse_event.button = WebMouseEvent::Button::kLeft; 3504 mouse_event.button = WebMouseEvent::Button::kLeft;
3505 mouse_event.SetPositionInWidget(1, 1); 3505 mouse_event.SetPositionInWidget(1, 1);
3506 mouse_event.click_count = 1; 3506 mouse_event.click_count = 1;
3507 web_view->HandleInputEvent(WebCoalescedInputEvent(mouse_event)); 3507 web_view->HandleInputEvent(WebCoalescedInputEvent(mouse_event));
3508 mouse_event.SetType(WebInputEvent::kMouseUp); 3508 mouse_event.SetType(WebInputEvent::kMouseUp);
3509 web_view->HandleInputEvent(WebCoalescedInputEvent(mouse_event)); 3509 web_view->HandleInputEvent(WebCoalescedInputEvent(mouse_event));
3510 3510
3511 EXPECT_EQ(1, client.GetUserGestureNotificationsCount()); 3511 EXPECT_EQ(1, client.GetUserGestureNotificationsCount());
3512 frame->SetAutofillClient(0); 3512 frame->SetAutofillClient(0);
3513 } 3513 }
3514 3514
3515 TEST_P(WebViewTest, CompositionIsUserGesture) { 3515 TEST_P(WebViewTest, CompositionIsUserGesture) {
3516 RegisterMockedHttpURLLoad("input_field_populated.html"); 3516 RegisterMockedHttpURLLoad("input_field_populated.html");
3517 WebViewBase* web_view = web_view_helper_.InitializeAndLoad( 3517 WebViewBase* web_view = web_view_helper_.InitializeAndLoad(
3518 base_url_ + "input_field_populated.html"); 3518 base_url_ + "input_field_populated.html");
3519 WebLocalFrameImpl* frame = web_view->MainFrameImpl(); 3519 WebLocalFrameBase* frame = web_view->MainFrameImpl();
3520 MockAutofillClient client; 3520 MockAutofillClient client;
3521 frame->SetAutofillClient(&client); 3521 frame->SetAutofillClient(&client);
3522 web_view->SetInitialFocus(false); 3522 web_view->SetInitialFocus(false);
3523 3523
3524 EXPECT_TRUE( 3524 EXPECT_TRUE(
3525 frame->FrameWidget()->GetActiveWebInputMethodController()->SetComposition( 3525 frame->FrameWidget()->GetActiveWebInputMethodController()->SetComposition(
3526 WebString::FromUTF8(std::string("hello").c_str()), 3526 WebString::FromUTF8(std::string("hello").c_str()),
3527 WebVector<WebCompositionUnderline>(), WebRange(), 3, 3)); 3527 WebVector<WebCompositionUnderline>(), WebRange(), 3, 3));
3528 EXPECT_EQ(1, client.TextChangesFromUserGesture()); 3528 EXPECT_EQ(1, client.TextChangesFromUserGesture());
3529 EXPECT_FALSE(UserGestureIndicator::ProcessingUserGesture()); 3529 EXPECT_FALSE(UserGestureIndicator::ProcessingUserGesture());
3530 EXPECT_TRUE(frame->HasMarkedText()); 3530 EXPECT_TRUE(frame->HasMarkedText());
3531 3531
3532 frame->SetAutofillClient(0); 3532 frame->SetAutofillClient(0);
3533 } 3533 }
3534 3534
3535 TEST_P(WebViewTest, CompareSelectAllToContentAsText) { 3535 TEST_P(WebViewTest, CompareSelectAllToContentAsText) {
3536 RegisterMockedHttpURLLoad("longpress_selection.html"); 3536 RegisterMockedHttpURLLoad("longpress_selection.html");
3537 WebViewBase* web_view = web_view_helper_.InitializeAndLoad( 3537 WebViewBase* web_view = web_view_helper_.InitializeAndLoad(
3538 base_url_ + "longpress_selection.html", true); 3538 base_url_ + "longpress_selection.html", true);
3539 3539
3540 WebLocalFrameImpl* frame = web_view->MainFrameImpl(); 3540 WebLocalFrameBase* frame = web_view->MainFrameImpl();
3541 frame->ExecuteScript(WebScriptSource( 3541 frame->ExecuteScript(WebScriptSource(
3542 WebString::FromUTF8("document.execCommand('SelectAll', false, null)"))); 3542 WebString::FromUTF8("document.execCommand('SelectAll', false, null)")));
3543 std::string actual = frame->SelectionAsText().Utf8(); 3543 std::string actual = frame->SelectionAsText().Utf8();
3544 3544
3545 const int kMaxOutputCharacters = 1024; 3545 const int kMaxOutputCharacters = 1024;
3546 std::string expected = 3546 std::string expected =
3547 WebFrameContentDumper::DumpWebViewAsText(web_view, kMaxOutputCharacters) 3547 WebFrameContentDumper::DumpWebViewAsText(web_view, kMaxOutputCharacters)
3548 .Utf8(); 3548 .Utf8();
3549 EXPECT_EQ(expected, actual); 3549 EXPECT_EQ(expected, actual);
3550 } 3550 }
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
3724 TEST_P(WebViewTest, ShowUnhandledTapUIIfNeededWithMutateDom) { 3724 TEST_P(WebViewTest, ShowUnhandledTapUIIfNeededWithMutateDom) {
3725 std::string test_file = "show_unhandled_tap.html"; 3725 std::string test_file = "show_unhandled_tap.html";
3726 RegisterMockedHttpURLLoad("Ahem.ttf"); 3726 RegisterMockedHttpURLLoad("Ahem.ttf");
3727 RegisterMockedHttpURLLoad(test_file); 3727 RegisterMockedHttpURLLoad(test_file);
3728 UnhandledTapWebViewClient client; 3728 UnhandledTapWebViewClient client;
3729 WebViewBase* web_view = web_view_helper_.InitializeAndLoad( 3729 WebViewBase* web_view = web_view_helper_.InitializeAndLoad(
3730 base_url_ + test_file, true, 0, &client); 3730 base_url_ + test_file, true, 0, &client);
3731 web_view->Resize(WebSize(500, 300)); 3731 web_view->Resize(WebSize(500, 300));
3732 web_view->UpdateAllLifecyclePhases(); 3732 web_view->UpdateAllLifecyclePhases();
3733 RunPendingTasks(); 3733 RunPendingTasks();
3734 WebLocalFrameImpl* frame = web_view->MainFrameImpl(); 3734 WebLocalFrameBase* frame = web_view->MainFrameImpl();
3735 3735
3736 // Test dom mutation. 3736 // Test dom mutation.
3737 TEST_EACH_MOUSEEVENT("mutateDom", TRUE); 3737 TEST_EACH_MOUSEEVENT("mutateDom", TRUE);
3738 3738
3739 // Test without any DOM mutation. 3739 // Test without any DOM mutation.
3740 client.Reset(); 3740 client.Reset();
3741 frame->ExecuteScript(WebScriptSource("setTest('none');")); 3741 frame->ExecuteScript(WebScriptSource("setTest('none');"));
3742 EXPECT_TRUE(TapElementById(WebInputEvent::kGestureTap, 3742 EXPECT_TRUE(TapElementById(WebInputEvent::kGestureTap,
3743 WebString::FromUTF8("target"))); 3743 WebString::FromUTF8("target")));
3744 EXPECT_FALSE(client.GetPageChanged()); 3744 EXPECT_FALSE(client.GetPageChanged());
3745 3745
3746 web_view_helper_.Reset(); // Remove dependency on locally scoped client. 3746 web_view_helper_.Reset(); // Remove dependency on locally scoped client.
3747 } 3747 }
3748 3748
3749 TEST_P(WebViewTest, ShowUnhandledTapUIIfNeededWithMutateStyle) { 3749 TEST_P(WebViewTest, ShowUnhandledTapUIIfNeededWithMutateStyle) {
3750 std::string test_file = "show_unhandled_tap.html"; 3750 std::string test_file = "show_unhandled_tap.html";
3751 RegisterMockedHttpURLLoad("Ahem.ttf"); 3751 RegisterMockedHttpURLLoad("Ahem.ttf");
3752 RegisterMockedHttpURLLoad(test_file); 3752 RegisterMockedHttpURLLoad(test_file);
3753 UnhandledTapWebViewClient client; 3753 UnhandledTapWebViewClient client;
3754 WebViewBase* web_view = web_view_helper_.InitializeAndLoad( 3754 WebViewBase* web_view = web_view_helper_.InitializeAndLoad(
3755 base_url_ + test_file, true, 0, &client); 3755 base_url_ + test_file, true, 0, &client);
3756 web_view->Resize(WebSize(500, 300)); 3756 web_view->Resize(WebSize(500, 300));
3757 web_view->UpdateAllLifecyclePhases(); 3757 web_view->UpdateAllLifecyclePhases();
3758 RunPendingTasks(); 3758 RunPendingTasks();
3759 WebLocalFrameImpl* frame = web_view->MainFrameImpl(); 3759 WebLocalFrameBase* frame = web_view->MainFrameImpl();
3760 3760
3761 // Test style mutation. 3761 // Test style mutation.
3762 TEST_EACH_MOUSEEVENT("mutateStyle", TRUE); 3762 TEST_EACH_MOUSEEVENT("mutateStyle", TRUE);
3763 3763
3764 // Test checkbox:indeterminate style mutation. 3764 // Test checkbox:indeterminate style mutation.
3765 TEST_EACH_MOUSEEVENT("mutateIndeterminate", TRUE); 3765 TEST_EACH_MOUSEEVENT("mutateIndeterminate", TRUE);
3766 3766
3767 // Test click div with :active style but it is not covered for now. 3767 // Test click div with :active style but it is not covered for now.
3768 client.Reset(); 3768 client.Reset();
3769 EXPECT_TRUE(TapElementById(WebInputEvent::kGestureTap, 3769 EXPECT_TRUE(TapElementById(WebInputEvent::kGestureTap,
(...skipping 13 matching lines...) Expand all
3783 TEST_P(WebViewTest, ShowUnhandledTapUIIfNeededWithPreventDefault) { 3783 TEST_P(WebViewTest, ShowUnhandledTapUIIfNeededWithPreventDefault) {
3784 std::string test_file = "show_unhandled_tap.html"; 3784 std::string test_file = "show_unhandled_tap.html";
3785 RegisterMockedHttpURLLoad("Ahem.ttf"); 3785 RegisterMockedHttpURLLoad("Ahem.ttf");
3786 RegisterMockedHttpURLLoad(test_file); 3786 RegisterMockedHttpURLLoad(test_file);
3787 UnhandledTapWebViewClient client; 3787 UnhandledTapWebViewClient client;
3788 WebViewBase* web_view = web_view_helper_.InitializeAndLoad( 3788 WebViewBase* web_view = web_view_helper_.InitializeAndLoad(
3789 base_url_ + test_file, true, 0, &client); 3789 base_url_ + test_file, true, 0, &client);
3790 web_view->Resize(WebSize(500, 300)); 3790 web_view->Resize(WebSize(500, 300));
3791 web_view->UpdateAllLifecyclePhases(); 3791 web_view->UpdateAllLifecyclePhases();
3792 RunPendingTasks(); 3792 RunPendingTasks();
3793 WebLocalFrameImpl* frame = web_view->MainFrameImpl(); 3793 WebLocalFrameBase* frame = web_view->MainFrameImpl();
3794 3794
3795 // Testswallowing. 3795 // Testswallowing.
3796 TEST_EACH_MOUSEEVENT("preventDefault", FALSE); 3796 TEST_EACH_MOUSEEVENT("preventDefault", FALSE);
3797 3797
3798 // Test without any preventDefault. 3798 // Test without any preventDefault.
3799 client.Reset(); 3799 client.Reset();
3800 frame->ExecuteScript(WebScriptSource("setTest('none');")); 3800 frame->ExecuteScript(WebScriptSource("setTest('none');"));
3801 EXPECT_TRUE(TapElementById(WebInputEvent::kGestureTap, 3801 EXPECT_TRUE(TapElementById(WebInputEvent::kGestureTap,
3802 WebString::FromUTF8("target"))); 3802 WebString::FromUTF8("target")));
3803 EXPECT_TRUE(client.GetWasCalled()); 3803 EXPECT_TRUE(client.GetWasCalled());
(...skipping 18 matching lines...) Expand all
3822 EXPECT_FALSE(document->GetFrame()->IsLoading()); 3822 EXPECT_FALSE(document->GetFrame()->IsLoading());
3823 } 3823 }
3824 3824
3825 #if OS(MACOSX) 3825 #if OS(MACOSX)
3826 TEST_P(WebViewTest, WebSubstringUtil) { 3826 TEST_P(WebViewTest, WebSubstringUtil) {
3827 RegisterMockedHttpURLLoad("content_editable_populated.html"); 3827 RegisterMockedHttpURLLoad("content_editable_populated.html");
3828 WebViewBase* web_view = web_view_helper_.InitializeAndLoad( 3828 WebViewBase* web_view = web_view_helper_.InitializeAndLoad(
3829 base_url_ + "content_editable_populated.html"); 3829 base_url_ + "content_editable_populated.html");
3830 web_view->GetSettings()->SetDefaultFontSize(12); 3830 web_view->GetSettings()->SetDefaultFontSize(12);
3831 web_view->Resize(WebSize(400, 400)); 3831 web_view->Resize(WebSize(400, 400));
3832 WebLocalFrameImpl* frame = web_view->MainFrameImpl(); 3832 WebLocalFrameBase* frame = web_view->MainFrameImpl();
3833 3833
3834 WebPoint baseline_point; 3834 WebPoint baseline_point;
3835 NSAttributedString* result = WebSubstringUtil::AttributedSubstringInRange( 3835 NSAttributedString* result = WebSubstringUtil::AttributedSubstringInRange(
3836 frame, 10, 3, &baseline_point); 3836 frame, 10, 3, &baseline_point);
3837 ASSERT_TRUE(!!result); 3837 ASSERT_TRUE(!!result);
3838 3838
3839 WebPoint point(baseline_point.x, baseline_point.y); 3839 WebPoint point(baseline_point.x, baseline_point.y);
3840 result = WebSubstringUtil::AttributedWordAtPoint(frame->FrameWidget(), point, 3840 result = WebSubstringUtil::AttributedWordAtPoint(frame->FrameWidget(), point,
3841 baseline_point); 3841 baseline_point);
3842 ASSERT_TRUE(!!result); 3842 ASSERT_TRUE(!!result);
3843 3843
3844 web_view->SetZoomLevel(3); 3844 web_view->SetZoomLevel(3);
3845 3845
3846 result = WebSubstringUtil::AttributedSubstringInRange(frame, 5, 5, 3846 result = WebSubstringUtil::AttributedSubstringInRange(frame, 5, 5,
3847 &baseline_point); 3847 &baseline_point);
3848 ASSERT_TRUE(!!result); 3848 ASSERT_TRUE(!!result);
3849 3849
3850 point = WebPoint(baseline_point.x, baseline_point.y); 3850 point = WebPoint(baseline_point.x, baseline_point.y);
3851 result = WebSubstringUtil::AttributedWordAtPoint(frame->FrameWidget(), point, 3851 result = WebSubstringUtil::AttributedWordAtPoint(frame->FrameWidget(), point,
3852 baseline_point); 3852 baseline_point);
3853 ASSERT_TRUE(!!result); 3853 ASSERT_TRUE(!!result);
3854 } 3854 }
3855 3855
3856 TEST_P(WebViewTest, WebSubstringUtilPinchZoom) { 3856 TEST_P(WebViewTest, WebSubstringUtilPinchZoom) {
3857 RegisterMockedHttpURLLoad("content_editable_populated.html"); 3857 RegisterMockedHttpURLLoad("content_editable_populated.html");
3858 WebViewBase* web_view = web_view_helper_.InitializeAndLoad( 3858 WebViewBase* web_view = web_view_helper_.InitializeAndLoad(
3859 base_url_ + "content_editable_populated.html"); 3859 base_url_ + "content_editable_populated.html");
3860 web_view->GetSettings()->SetDefaultFontSize(12); 3860 web_view->GetSettings()->SetDefaultFontSize(12);
3861 web_view->Resize(WebSize(400, 400)); 3861 web_view->Resize(WebSize(400, 400));
3862 WebLocalFrameImpl* frame = web_view->MainFrameImpl(); 3862 WebLocalFrameBase* frame = web_view->MainFrameImpl();
3863 NSAttributedString* result = nil; 3863 NSAttributedString* result = nil;
3864 3864
3865 WebPoint baseline_point; 3865 WebPoint baseline_point;
3866 result = WebSubstringUtil::AttributedSubstringInRange(frame, 10, 3, 3866 result = WebSubstringUtil::AttributedSubstringInRange(frame, 10, 3,
3867 &baseline_point); 3867 &baseline_point);
3868 ASSERT_TRUE(!!result); 3868 ASSERT_TRUE(!!result);
3869 3869
3870 web_view->SetPageScaleFactor(3); 3870 web_view->SetPageScaleFactor(3);
3871 3871
3872 WebPoint point_after_zoom; 3872 WebPoint point_after_zoom;
3873 result = WebSubstringUtil::AttributedSubstringInRange(frame, 10, 3, 3873 result = WebSubstringUtil::AttributedSubstringInRange(frame, 10, 3,
3874 &point_after_zoom); 3874 &point_after_zoom);
3875 ASSERT_TRUE(!!result); 3875 ASSERT_TRUE(!!result);
3876 3876
3877 // We won't have moved by a full factor of 3 because of the translations, but 3877 // We won't have moved by a full factor of 3 because of the translations, but
3878 // we should move by a factor of >2. 3878 // we should move by a factor of >2.
3879 EXPECT_LT(2 * baseline_point.x, point_after_zoom.x); 3879 EXPECT_LT(2 * baseline_point.x, point_after_zoom.x);
3880 EXPECT_LT(2 * baseline_point.y, point_after_zoom.y); 3880 EXPECT_LT(2 * baseline_point.y, point_after_zoom.y);
3881 } 3881 }
3882 3882
3883 TEST_P(WebViewTest, WebSubstringUtilIframe) { 3883 TEST_P(WebViewTest, WebSubstringUtilIframe) {
3884 RegisterMockedHttpURLLoad("single_iframe.html"); 3884 RegisterMockedHttpURLLoad("single_iframe.html");
3885 RegisterMockedHttpURLLoad("visible_iframe.html"); 3885 RegisterMockedHttpURLLoad("visible_iframe.html");
3886 WebViewBase* web_view = 3886 WebViewBase* web_view =
3887 web_view_helper_.InitializeAndLoad(base_url_ + "single_iframe.html"); 3887 web_view_helper_.InitializeAndLoad(base_url_ + "single_iframe.html");
3888 web_view->GetSettings()->SetDefaultFontSize(12); 3888 web_view->GetSettings()->SetDefaultFontSize(12);
3889 web_view->GetSettings()->SetJavaScriptEnabled(true); 3889 web_view->GetSettings()->SetJavaScriptEnabled(true);
3890 web_view->Resize(WebSize(400, 400)); 3890 web_view->Resize(WebSize(400, 400));
3891 WebLocalFrameImpl* main_frame = web_view->MainFrameImpl(); 3891 WebLocalFrameBase* main_frame = web_view->MainFrameImpl();
3892 WebLocalFrameImpl* child_frame = WebLocalFrameImpl::FromFrame( 3892 WebLocalFrameBase* child_frame = WebLocalFrameBase::FromFrame(
3893 ToLocalFrame(main_frame->GetFrame()->Tree().FirstChild())); 3893 ToLocalFrame(main_frame->GetFrame()->Tree().FirstChild()));
3894 3894
3895 WebPoint baseline_point; 3895 WebPoint baseline_point;
3896 NSAttributedString* result = WebSubstringUtil::AttributedSubstringInRange( 3896 NSAttributedString* result = WebSubstringUtil::AttributedSubstringInRange(
3897 child_frame, 11, 7, &baseline_point); 3897 child_frame, 11, 7, &baseline_point);
3898 ASSERT_NE(result, nullptr); 3898 ASSERT_NE(result, nullptr);
3899 3899
3900 WebPoint point(baseline_point.x, baseline_point.y); 3900 WebPoint point(baseline_point.x, baseline_point.y);
3901 result = WebSubstringUtil::AttributedWordAtPoint(main_frame->FrameWidget(), 3901 result = WebSubstringUtil::AttributedWordAtPoint(main_frame->FrameWidget(),
3902 point, baseline_point); 3902 point, baseline_point);
(...skipping 13 matching lines...) Expand all
3916 EXPECT_EQ(y_before_change, baseline_point.y - 100); 3916 EXPECT_EQ(y_before_change, baseline_point.y - 100);
3917 } 3917 }
3918 3918
3919 #endif 3919 #endif
3920 3920
3921 TEST_P(WebViewTest, PasswordFieldEditingIsUserGesture) { 3921 TEST_P(WebViewTest, PasswordFieldEditingIsUserGesture) {
3922 RegisterMockedHttpURLLoad("input_field_password.html"); 3922 RegisterMockedHttpURLLoad("input_field_password.html");
3923 MockAutofillClient client; 3923 MockAutofillClient client;
3924 WebViewBase* web_view = web_view_helper_.InitializeAndLoad( 3924 WebViewBase* web_view = web_view_helper_.InitializeAndLoad(
3925 base_url_ + "input_field_password.html", true); 3925 base_url_ + "input_field_password.html", true);
3926 WebLocalFrameImpl* frame = web_view->MainFrameImpl(); 3926 WebLocalFrameBase* frame = web_view->MainFrameImpl();
3927 frame->SetAutofillClient(&client); 3927 frame->SetAutofillClient(&client);
3928 web_view->SetInitialFocus(false); 3928 web_view->SetInitialFocus(false);
3929 3929
3930 WebVector<WebCompositionUnderline> empty_underlines; 3930 WebVector<WebCompositionUnderline> empty_underlines;
3931 3931
3932 EXPECT_TRUE( 3932 EXPECT_TRUE(
3933 frame->FrameWidget()->GetActiveWebInputMethodController()->CommitText( 3933 frame->FrameWidget()->GetActiveWebInputMethodController()->CommitText(
3934 WebString::FromUTF8(std::string("hello").c_str()), empty_underlines, 3934 WebString::FromUTF8(std::string("hello").c_str()), empty_underlines,
3935 WebRange(), 0)); 3935 WebRange(), 0));
3936 EXPECT_EQ(1, client.TextChangesFromUserGesture()); 3936 EXPECT_EQ(1, client.TextChangesFromUserGesture());
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
4184 4184
4185 WebURL base_url = URLTestHelpers::ToKURL("http://example.com/"); 4185 WebURL base_url = URLTestHelpers::ToKURL("http://example.com/");
4186 FrameTestHelpers::LoadHTMLString(web_view->MainFrame(), 4186 FrameTestHelpers::LoadHTMLString(web_view->MainFrame(),
4187 "<style>" 4187 "<style>"
4188 " body { margin: 0px; }" 4188 " body { margin: 0px; }"
4189 " #vw { width: 100vw; height: 100vh; }" 4189 " #vw { width: 100vw; height: 100vh; }"
4190 "</style>" 4190 "</style>"
4191 "<div id=vw></div>", 4191 "<div id=vw></div>",
4192 base_url); 4192 base_url);
4193 4193
4194 WebLocalFrameImpl* frame = web_view->MainFrameImpl(); 4194 WebLocalFrameBase* frame = web_view->MainFrameImpl();
4195 Document* document = frame->GetFrame()->GetDocument(); 4195 Document* document = frame->GetFrame()->GetDocument();
4196 Element* vw_element = document->getElementById("vw"); 4196 Element* vw_element = document->getElementById("vw");
4197 4197
4198 EXPECT_EQ(800, vw_element->OffsetWidth()); 4198 EXPECT_EQ(800, vw_element->OffsetWidth());
4199 4199
4200 FloatSize page_size(300, 360); 4200 FloatSize page_size(300, 360);
4201 4201
4202 WebPrintParams print_params; 4202 WebPrintParams print_params;
4203 print_params.print_content_area.width = page_size.Width(); 4203 print_params.print_content_area.width = page_size.Width();
4204 print_params.print_content_area.height = page_size.Height(); 4204 print_params.print_content_area.height = page_size.Height();
(...skipping 24 matching lines...) Expand all
4229 WebURL base_url = URLTestHelpers::ToKURL("http://example.com/"); 4229 WebURL base_url = URLTestHelpers::ToKURL("http://example.com/");
4230 FrameTestHelpers::LoadHTMLString(web_view->MainFrame(), 4230 FrameTestHelpers::LoadHTMLString(web_view->MainFrame(),
4231 "<style>" 4231 "<style>"
4232 " @media (max-width: 600px) {" 4232 " @media (max-width: 600px) {"
4233 " div { color: green }" 4233 " div { color: green }"
4234 " }" 4234 " }"
4235 "</style>" 4235 "</style>"
4236 "<div id=d></div>", 4236 "<div id=d></div>",
4237 base_url); 4237 base_url);
4238 4238
4239 WebLocalFrameImpl* frame = web_view->MainFrameImpl(); 4239 WebLocalFrameBase* frame = web_view->MainFrameImpl();
4240 Document* document = frame->GetFrame()->GetDocument(); 4240 Document* document = frame->GetFrame()->GetDocument();
4241 Element* div = document->getElementById("d"); 4241 Element* div = document->getElementById("d");
4242 4242
4243 EXPECT_EQ(MakeRGB(0, 128, 0), 4243 EXPECT_EQ(MakeRGB(0, 128, 0),
4244 div->GetComputedStyle()->VisitedDependentColor(CSSPropertyColor)); 4244 div->GetComputedStyle()->VisitedDependentColor(CSSPropertyColor));
4245 4245
4246 FloatSize page_size(300, 360); 4246 FloatSize page_size(300, 360);
4247 4247
4248 WebPrintParams print_params; 4248 WebPrintParams print_params;
4249 print_params.print_content_area.width = page_size.Width(); 4249 print_params.print_content_area.width = page_size.Width();
(...skipping 15 matching lines...) Expand all
4265 FrameTestHelpers::LoadHTMLString(web_view->MainFrame(), 4265 FrameTestHelpers::LoadHTMLString(web_view->MainFrame(),
4266 "<style>" 4266 "<style>"
4267 " body { margin: 0 }" 4267 " body { margin: 0 }"
4268 " #t1 { width: 100% }" 4268 " #t1 { width: 100% }"
4269 " #t2 { width: 100vw }" 4269 " #t2 { width: 100vw }"
4270 "</style>" 4270 "</style>"
4271 "<div id=t1></div>" 4271 "<div id=t1></div>"
4272 "<div id=t2></div>", 4272 "<div id=t2></div>",
4273 base_url); 4273 base_url);
4274 4274
4275 WebLocalFrameImpl* frame = web_view->MainFrameImpl(); 4275 WebLocalFrameBase* frame = web_view->MainFrameImpl();
4276 Document* document = frame->GetFrame()->GetDocument(); 4276 Document* document = frame->GetFrame()->GetDocument();
4277 Element* t1 = document->getElementById("t1"); 4277 Element* t1 = document->getElementById("t1");
4278 Element* t2 = document->getElementById("t2"); 4278 Element* t2 = document->getElementById("t2");
4279 4279
4280 EXPECT_EQ(400, t1->OffsetWidth()); 4280 EXPECT_EQ(400, t1->OffsetWidth());
4281 EXPECT_EQ(400, t2->OffsetWidth()); 4281 EXPECT_EQ(400, t2->OffsetWidth());
4282 4282
4283 FloatSize page_size(600, 720); 4283 FloatSize page_size(600, 720);
4284 int expected_width = PrintICBSizeFromPageSize(page_size).Width(); 4284 int expected_width = PrintICBSizeFromPageSize(page_size).Width();
4285 4285
(...skipping 16 matching lines...) Expand all
4302 WebURL base_url = URLTestHelpers::ToKURL("http://example.com/"); 4302 WebURL base_url = URLTestHelpers::ToKURL("http://example.com/");
4303 FrameTestHelpers::LoadHTMLString(web_view->MainFrame(), 4303 FrameTestHelpers::LoadHTMLString(web_view->MainFrame(),
4304 "<!doctype html>" 4304 "<!doctype html>"
4305 "<meta name='viewport'" 4305 "<meta name='viewport'"
4306 " content='width=device-width'>" 4306 " content='width=device-width'>"
4307 "<style>" 4307 "<style>"
4308 " body {margin: 0px; height:3000px;}" 4308 " body {margin: 0px; height:3000px;}"
4309 "</style>", 4309 "</style>",
4310 base_url); 4310 base_url);
4311 4311
4312 WebLocalFrameImpl* frame = web_view->MainFrameImpl(); 4312 WebLocalFrameBase* frame = web_view->MainFrameImpl();
4313 auto* frame_view = frame->GetFrameView(); 4313 auto* frame_view = frame->GetFrameView();
4314 EXPECT_FALSE(frame_view->VisualViewportSuppliesScrollbars()); 4314 EXPECT_FALSE(frame_view->VisualViewportSuppliesScrollbars());
4315 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { 4315 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) {
4316 EXPECT_NE(nullptr, 4316 EXPECT_NE(nullptr,
4317 frame_view->LayoutViewportScrollableArea()->VerticalScrollbar()); 4317 frame_view->LayoutViewportScrollableArea()->VerticalScrollbar());
4318 } else { 4318 } else {
4319 EXPECT_NE(nullptr, frame_view->VerticalScrollbar()); 4319 EXPECT_NE(nullptr, frame_view->VerticalScrollbar());
4320 } 4320 }
4321 4321
4322 WebDeviceEmulationParams params; 4322 WebDeviceEmulationParams params;
(...skipping 15 matching lines...) Expand all
4338 EXPECT_FALSE(frame_view->VisualViewportSuppliesScrollbars()); 4338 EXPECT_FALSE(frame_view->VisualViewportSuppliesScrollbars());
4339 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { 4339 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) {
4340 EXPECT_NE(nullptr, 4340 EXPECT_NE(nullptr,
4341 frame_view->LayoutViewportScrollableArea()->VerticalScrollbar()); 4341 frame_view->LayoutViewportScrollableArea()->VerticalScrollbar());
4342 } else { 4342 } else {
4343 EXPECT_NE(nullptr, frame_view->VerticalScrollbar()); 4343 EXPECT_NE(nullptr, frame_view->VerticalScrollbar());
4344 } 4344 }
4345 } 4345 }
4346 4346
4347 } // namespace blink 4347 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/tests/WebFrameTest.cpp ('k') | third_party/WebKit/Source/web/tests/sim/SimTest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698