| 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 2390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2401 | 2401 |
| 2402 WebViewBase* web_view = web_view_helper_.InitializeAndLoad( | 2402 WebViewBase* web_view = web_view_helper_.InitializeAndLoad( |
| 2403 base_url_ + "longpress_image_contenteditable.html", true); | 2403 base_url_ + "longpress_image_contenteditable.html", true); |
| 2404 web_view->Resize(WebSize(500, 300)); | 2404 web_view->Resize(WebSize(500, 300)); |
| 2405 web_view->UpdateAllLifecyclePhases(); | 2405 web_view->UpdateAllLifecyclePhases(); |
| 2406 RunPendingTasks(); | 2406 RunPendingTasks(); |
| 2407 | 2407 |
| 2408 WebString image = WebString::FromUTF8("purpleimage"); | 2408 WebString image = WebString::FromUTF8("purpleimage"); |
| 2409 | 2409 |
| 2410 EXPECT_TRUE(TapElementById(WebInputEvent::kGestureLongPress, image)); | 2410 EXPECT_TRUE(TapElementById(WebInputEvent::kGestureLongPress, image)); |
| 2411 WebRange range = web_view->CaretOrSelectionRange(); | 2411 WebRange range = web_view->MainFrameImpl() |
| 2412 ->GetInputMethodController() |
| 2413 ->GetSelectionOffsets(); |
| 2412 EXPECT_FALSE(range.IsNull()); | 2414 EXPECT_FALSE(range.IsNull()); |
| 2413 EXPECT_EQ(0, range.StartOffset()); | 2415 EXPECT_EQ(0, range.StartOffset()); |
| 2414 EXPECT_EQ(1, range.length()); | 2416 EXPECT_EQ(1, range.length()); |
| 2415 } | 2417 } |
| 2416 | 2418 |
| 2417 TEST_P(WebViewTest, BlinkCaretAfterLongPress) { | 2419 TEST_P(WebViewTest, BlinkCaretAfterLongPress) { |
| 2418 RegisterMockedHttpURLLoad("blink_caret_on_typing_after_long_press.html"); | 2420 RegisterMockedHttpURLLoad("blink_caret_on_typing_after_long_press.html"); |
| 2419 | 2421 |
| 2420 WebViewBase* web_view = web_view_helper_.InitializeAndLoad( | 2422 WebViewBase* web_view = web_view_helper_.InitializeAndLoad( |
| 2421 base_url_ + "blink_caret_on_typing_after_long_press.html", true); | 2423 base_url_ + "blink_caret_on_typing_after_long_press.html", true); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2470 base_url_ + "selection_readonly.html", true); | 2472 base_url_ + "selection_readonly.html", true); |
| 2471 web_view->Resize(WebSize(640, 480)); | 2473 web_view->Resize(WebSize(640, 480)); |
| 2472 web_view->UpdateAllLifecyclePhases(); | 2474 web_view->UpdateAllLifecyclePhases(); |
| 2473 RunPendingTasks(); | 2475 RunPendingTasks(); |
| 2474 | 2476 |
| 2475 std::string test_word = "This text should be selected."; | 2477 std::string test_word = "This text should be selected."; |
| 2476 | 2478 |
| 2477 WebLocalFrameBase* frame = web_view->MainFrameImpl(); | 2479 WebLocalFrameBase* frame = web_view->MainFrameImpl(); |
| 2478 EXPECT_EQ(test_word, std::string(frame->SelectionAsText().Utf8().data())); | 2480 EXPECT_EQ(test_word, std::string(frame->SelectionAsText().Utf8().data())); |
| 2479 | 2481 |
| 2480 WebRange range = web_view->CaretOrSelectionRange(); | 2482 WebRange range = web_view->MainFrameImpl() |
| 2483 ->GetInputMethodController() |
| 2484 ->GetSelectionOffsets(); |
| 2481 EXPECT_FALSE(range.IsNull()); | 2485 EXPECT_FALSE(range.IsNull()); |
| 2482 EXPECT_EQ(0, range.StartOffset()); | 2486 EXPECT_EQ(0, range.StartOffset()); |
| 2483 EXPECT_EQ(static_cast<int>(test_word.length()), range.length()); | 2487 EXPECT_EQ(static_cast<int>(test_word.length()), range.length()); |
| 2484 } | 2488 } |
| 2485 | 2489 |
| 2486 TEST_P(WebViewTest, KeyDownScrollsHandled) { | 2490 TEST_P(WebViewTest, KeyDownScrollsHandled) { |
| 2487 RegisterMockedHttpURLLoad("content-width-1000.html"); | 2491 RegisterMockedHttpURLLoad("content-width-1000.html"); |
| 2488 | 2492 |
| 2489 WebViewBase* web_view = web_view_helper_.InitializeAndLoad( | 2493 WebViewBase* web_view = web_view_helper_.InitializeAndLoad( |
| 2490 base_url_ + "content-width-1000.html", true); | 2494 base_url_ + "content-width-1000.html", true); |
| (...skipping 1847 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4338 EXPECT_FALSE(frame_view->VisualViewportSuppliesScrollbars()); | 4342 EXPECT_FALSE(frame_view->VisualViewportSuppliesScrollbars()); |
| 4339 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { | 4343 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { |
| 4340 EXPECT_NE(nullptr, | 4344 EXPECT_NE(nullptr, |
| 4341 frame_view->LayoutViewportScrollableArea()->VerticalScrollbar()); | 4345 frame_view->LayoutViewportScrollableArea()->VerticalScrollbar()); |
| 4342 } else { | 4346 } else { |
| 4343 EXPECT_NE(nullptr, frame_view->VerticalScrollbar()); | 4347 EXPECT_NE(nullptr, frame_view->VerticalScrollbar()); |
| 4344 } | 4348 } |
| 4345 } | 4349 } |
| 4346 | 4350 |
| 4347 } // namespace blink | 4351 } // namespace blink |
| OLD | NEW |