| 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 2393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2404 | 2404 |
| 2405 WebViewBase* web_view = web_view_helper_.InitializeAndLoad( | 2405 WebViewBase* web_view = web_view_helper_.InitializeAndLoad( |
| 2406 base_url_ + "longpress_image_contenteditable.html"); | 2406 base_url_ + "longpress_image_contenteditable.html"); |
| 2407 web_view->Resize(WebSize(500, 300)); | 2407 web_view->Resize(WebSize(500, 300)); |
| 2408 web_view->UpdateAllLifecyclePhases(); | 2408 web_view->UpdateAllLifecyclePhases(); |
| 2409 RunPendingTasks(); | 2409 RunPendingTasks(); |
| 2410 | 2410 |
| 2411 WebString image = WebString::FromUTF8("purpleimage"); | 2411 WebString image = WebString::FromUTF8("purpleimage"); |
| 2412 | 2412 |
| 2413 EXPECT_TRUE(TapElementById(WebInputEvent::kGestureLongPress, image)); | 2413 EXPECT_TRUE(TapElementById(WebInputEvent::kGestureLongPress, image)); |
| 2414 WebRange range = web_view->CaretOrSelectionRange(); | 2414 WebRange range = web_view->MainFrameImpl() |
| 2415 ->GetInputMethodController() |
| 2416 ->GetSelectionOffsets(); |
| 2415 EXPECT_FALSE(range.IsNull()); | 2417 EXPECT_FALSE(range.IsNull()); |
| 2416 EXPECT_EQ(0, range.StartOffset()); | 2418 EXPECT_EQ(0, range.StartOffset()); |
| 2417 EXPECT_EQ(1, range.length()); | 2419 EXPECT_EQ(1, range.length()); |
| 2418 } | 2420 } |
| 2419 | 2421 |
| 2420 TEST_P(WebViewTest, BlinkCaretAfterLongPress) { | 2422 TEST_P(WebViewTest, BlinkCaretAfterLongPress) { |
| 2421 RegisterMockedHttpURLLoad("blink_caret_on_typing_after_long_press.html"); | 2423 RegisterMockedHttpURLLoad("blink_caret_on_typing_after_long_press.html"); |
| 2422 | 2424 |
| 2423 WebViewBase* web_view = web_view_helper_.InitializeAndLoad( | 2425 WebViewBase* web_view = web_view_helper_.InitializeAndLoad( |
| 2424 base_url_ + "blink_caret_on_typing_after_long_press.html"); | 2426 base_url_ + "blink_caret_on_typing_after_long_press.html"); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2473 web_view_helper_.InitializeAndLoad(base_url_ + "selection_readonly.html"); | 2475 web_view_helper_.InitializeAndLoad(base_url_ + "selection_readonly.html"); |
| 2474 web_view->Resize(WebSize(640, 480)); | 2476 web_view->Resize(WebSize(640, 480)); |
| 2475 web_view->UpdateAllLifecyclePhases(); | 2477 web_view->UpdateAllLifecyclePhases(); |
| 2476 RunPendingTasks(); | 2478 RunPendingTasks(); |
| 2477 | 2479 |
| 2478 std::string test_word = "This text should be selected."; | 2480 std::string test_word = "This text should be selected."; |
| 2479 | 2481 |
| 2480 WebLocalFrameBase* frame = web_view->MainFrameImpl(); | 2482 WebLocalFrameBase* frame = web_view->MainFrameImpl(); |
| 2481 EXPECT_EQ(test_word, std::string(frame->SelectionAsText().Utf8().data())); | 2483 EXPECT_EQ(test_word, std::string(frame->SelectionAsText().Utf8().data())); |
| 2482 | 2484 |
| 2483 WebRange range = web_view->CaretOrSelectionRange(); | 2485 WebRange range = web_view->MainFrameImpl() |
| 2486 ->GetInputMethodController() |
| 2487 ->GetSelectionOffsets(); |
| 2484 EXPECT_FALSE(range.IsNull()); | 2488 EXPECT_FALSE(range.IsNull()); |
| 2485 EXPECT_EQ(0, range.StartOffset()); | 2489 EXPECT_EQ(0, range.StartOffset()); |
| 2486 EXPECT_EQ(static_cast<int>(test_word.length()), range.length()); | 2490 EXPECT_EQ(static_cast<int>(test_word.length()), range.length()); |
| 2487 } | 2491 } |
| 2488 | 2492 |
| 2489 TEST_P(WebViewTest, KeyDownScrollsHandled) { | 2493 TEST_P(WebViewTest, KeyDownScrollsHandled) { |
| 2490 RegisterMockedHttpURLLoad("content-width-1000.html"); | 2494 RegisterMockedHttpURLLoad("content-width-1000.html"); |
| 2491 | 2495 |
| 2492 WebViewBase* web_view = | 2496 WebViewBase* web_view = |
| 2493 web_view_helper_.InitializeAndLoad(base_url_ + "content-width-1000.html"); | 2497 web_view_helper_.InitializeAndLoad(base_url_ + "content-width-1000.html"); |
| (...skipping 1904 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4398 EXPECT_FALSE(frame_view->VisualViewportSuppliesScrollbars()); | 4402 EXPECT_FALSE(frame_view->VisualViewportSuppliesScrollbars()); |
| 4399 if (RuntimeEnabledFeatures::RootLayerScrollingEnabled()) { | 4403 if (RuntimeEnabledFeatures::RootLayerScrollingEnabled()) { |
| 4400 EXPECT_NE(nullptr, | 4404 EXPECT_NE(nullptr, |
| 4401 frame_view->LayoutViewportScrollableArea()->VerticalScrollbar()); | 4405 frame_view->LayoutViewportScrollableArea()->VerticalScrollbar()); |
| 4402 } else { | 4406 } else { |
| 4403 EXPECT_NE(nullptr, frame_view->VerticalScrollbar()); | 4407 EXPECT_NE(nullptr, frame_view->VerticalScrollbar()); |
| 4404 } | 4408 } |
| 4405 } | 4409 } |
| 4406 | 4410 |
| 4407 } // namespace blink | 4411 } // namespace blink |
| OLD | NEW |