OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 6631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6642 | 6642 |
6643 EXPECT_EQ(1, textcheck.NumberOfTimesChecked()); | 6643 EXPECT_EQ(1, textcheck.NumberOfTimesChecked()); |
6644 EXPECT_EQ(1, NumMarkersInRange(document, selection_range, | 6644 EXPECT_EQ(1, NumMarkersInRange(document, selection_range, |
6645 DocumentMarker::kSpelling)); | 6645 DocumentMarker::kSpelling)); |
6646 | 6646 |
6647 frame->ReplaceMisspelledRange("welcome"); | 6647 frame->ReplaceMisspelledRange("welcome"); |
6648 EXPECT_EQ("_welcome_.", | 6648 EXPECT_EQ("_welcome_.", |
6649 WebFrameContentDumper::DumpWebViewAsText( | 6649 WebFrameContentDumper::DumpWebViewAsText( |
6650 web_view_helper.WebView(), std::numeric_limits<size_t>::max()) | 6650 web_view_helper.WebView(), std::numeric_limits<size_t>::max()) |
6651 .Utf8()); | 6651 .Utf8()); |
| 6652 |
| 6653 const int kAllNewTextBeginOffset = 0; |
| 6654 const int kAllNewTextLength = 10; |
| 6655 frame->SelectRange(WebRange(kAllNewTextBeginOffset, kAllNewTextLength)); |
| 6656 selection_range = frame->GetFrame() |
| 6657 ->Selection() |
| 6658 .ComputeVisibleSelectionInDOMTreeDeprecated() |
| 6659 .ToNormalizedEphemeralRange(); |
| 6660 EXPECT_EQ(0, NumMarkersInRange(document, selection_range, |
| 6661 DocumentMarker::kSpelling)); |
6652 } | 6662 } |
6653 | 6663 |
6654 TEST_P(ParameterizedWebFrameTest, RemoveSpellingMarkers) { | 6664 TEST_P(ParameterizedWebFrameTest, RemoveSpellingMarkers) { |
6655 RegisterMockedHttpURLLoad("spell.html"); | 6665 RegisterMockedHttpURLLoad("spell.html"); |
6656 FrameTestHelpers::WebViewHelper web_view_helper; | 6666 FrameTestHelpers::WebViewHelper web_view_helper; |
6657 InitializeTextSelectionWebView(base_url_ + "spell.html", &web_view_helper); | 6667 InitializeTextSelectionWebView(base_url_ + "spell.html", &web_view_helper); |
6658 | 6668 |
6659 WebLocalFrameImpl* frame = web_view_helper.WebView()->MainFrameImpl(); | 6669 WebLocalFrameImpl* frame = web_view_helper.WebView()->MainFrameImpl(); |
6660 TextCheckClient textcheck; | 6670 TextCheckClient textcheck; |
6661 frame->SetTextCheckClient(&textcheck); | 6671 frame->SetTextCheckClient(&textcheck); |
(...skipping 5485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12147 | 12157 |
12148 // Failing the original child frame navigation and trying to render fallback | 12158 // Failing the original child frame navigation and trying to render fallback |
12149 // content shouldn't crash. It should return NoLoadInProgress. This is so the | 12159 // content shouldn't crash. It should return NoLoadInProgress. This is so the |
12150 // caller won't attempt to replace the correctly empty frame with an error | 12160 // caller won't attempt to replace the correctly empty frame with an error |
12151 // page. | 12161 // page. |
12152 EXPECT_EQ(WebLocalFrame::NoLoadInProgress, | 12162 EXPECT_EQ(WebLocalFrame::NoLoadInProgress, |
12153 child->MaybeRenderFallbackContent(WebURLError())); | 12163 child->MaybeRenderFallbackContent(WebURLError())); |
12154 } | 12164 } |
12155 | 12165 |
12156 } // namespace blink | 12166 } // namespace blink |
OLD | NEW |