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 2062 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2073 m_webView->layout(); | 2073 m_webView->layout(); |
2074 runPendingTasks(); | 2074 runPendingTasks(); |
2075 | 2075 |
2076 // Note that the 'result 19' in the <select> element is not expected to prod
uce a match. | 2076 // Note that the 'result 19' in the <select> element is not expected to prod
uce a match. |
2077 static const char* kFindString = "result"; | 2077 static const char* kFindString = "result"; |
2078 static const int kFindIdentifier = 12345; | 2078 static const int kFindIdentifier = 12345; |
2079 static const int kNumResults = 19; | 2079 static const int kNumResults = 19; |
2080 | 2080 |
2081 WebFindOptions options; | 2081 WebFindOptions options; |
2082 WebString searchText = WebString::fromUTF8(kFindString); | 2082 WebString searchText = WebString::fromUTF8(kFindString); |
2083 WebFrameImpl* mainFrame = static_cast<WebFrameImpl*>(m_webView->mainFrame())
; | 2083 WebFrameImpl* mainFrame = toWebFrameImpl(m_webView->mainFrame()); |
2084 EXPECT_TRUE(mainFrame->find(kFindIdentifier, searchText, options, false, 0))
; | 2084 EXPECT_TRUE(mainFrame->find(kFindIdentifier, searchText, options, false, 0))
; |
2085 | 2085 |
2086 mainFrame->resetMatchCount(); | 2086 mainFrame->resetMatchCount(); |
2087 | 2087 |
2088 for (WebFrame* frame = mainFrame; frame; frame = frame->traverseNext(false)) | 2088 for (WebFrame* frame = mainFrame; frame; frame = frame->traverseNext(false)) |
2089 frame->scopeStringMatches(kFindIdentifier, searchText, options, true); | 2089 frame->scopeStringMatches(kFindIdentifier, searchText, options, true); |
2090 | 2090 |
2091 runPendingTasks(); | 2091 runPendingTasks(); |
2092 EXPECT_TRUE(client.findResultsAreReady()); | 2092 EXPECT_TRUE(client.findResultsAreReady()); |
2093 | 2093 |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2192 m_webView->resize(WebSize(640, 480)); | 2192 m_webView->resize(WebSize(640, 480)); |
2193 m_webView->layout(); | 2193 m_webView->layout(); |
2194 runPendingTasks(); | 2194 runPendingTasks(); |
2195 | 2195 |
2196 static const char* kFindString = "hello"; | 2196 static const char* kFindString = "hello"; |
2197 static const int kFindIdentifier = 12345; | 2197 static const int kFindIdentifier = 12345; |
2198 static const int kNumResults = 1; | 2198 static const int kNumResults = 1; |
2199 | 2199 |
2200 WebFindOptions options; | 2200 WebFindOptions options; |
2201 WebString searchText = WebString::fromUTF8(kFindString); | 2201 WebString searchText = WebString::fromUTF8(kFindString); |
2202 WebFrameImpl* mainFrame = static_cast<WebFrameImpl*>(m_webView->mainFrame())
; | 2202 WebFrameImpl* mainFrame = toWebFrameImpl(m_webView->mainFrame()); |
2203 EXPECT_TRUE(mainFrame->find(kFindIdentifier, searchText, options, false, 0))
; | 2203 EXPECT_TRUE(mainFrame->find(kFindIdentifier, searchText, options, false, 0))
; |
2204 | 2204 |
2205 mainFrame->resetMatchCount(); | 2205 mainFrame->resetMatchCount(); |
2206 | 2206 |
2207 for (WebFrame* frame = mainFrame; frame; frame = frame->traverseNext(false)) | 2207 for (WebFrame* frame = mainFrame; frame; frame = frame->traverseNext(false)) |
2208 frame->scopeStringMatches(kFindIdentifier, searchText, options, true); | 2208 frame->scopeStringMatches(kFindIdentifier, searchText, options, true); |
2209 | 2209 |
2210 runPendingTasks(); | 2210 runPendingTasks(); |
2211 EXPECT_TRUE(client.findResultsAreReady()); | 2211 EXPECT_TRUE(client.findResultsAreReady()); |
2212 EXPECT_EQ(kNumResults, client.count()); | 2212 EXPECT_EQ(kNumResults, client.count()); |
(...skipping 11 matching lines...) Expand all Loading... |
2224 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "find_in_page
.html", true, &client); | 2224 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "find_in_page
.html", true, &client); |
2225 m_webView->resize(WebSize(640, 480)); | 2225 m_webView->resize(WebSize(640, 480)); |
2226 m_webView->layout(); | 2226 m_webView->layout(); |
2227 runPendingTasks(); | 2227 runPendingTasks(); |
2228 | 2228 |
2229 static const char* kFindString = "result"; | 2229 static const char* kFindString = "result"; |
2230 static const int kFindIdentifier = 12345; | 2230 static const int kFindIdentifier = 12345; |
2231 | 2231 |
2232 WebFindOptions options; | 2232 WebFindOptions options; |
2233 WebString searchText = WebString::fromUTF8(kFindString); | 2233 WebString searchText = WebString::fromUTF8(kFindString); |
2234 WebFrameImpl* mainFrame = static_cast<WebFrameImpl*>(m_webView->mainFrame())
; | 2234 WebFrameImpl* mainFrame = toWebFrameImpl(m_webView->mainFrame()); |
2235 WebFrameImpl* secondFrame = static_cast<WebFrameImpl*>(mainFrame->traverseNe
xt(false)); | 2235 WebFrameImpl* secondFrame = toWebFrameImpl(mainFrame->traverseNext(false)); |
2236 RefPtr<WebCore::Frame> holdSecondFrame = secondFrame->frame(); | 2236 RefPtr<WebCore::Frame> holdSecondFrame = secondFrame->frame(); |
2237 | 2237 |
2238 // Detach the frame before finding. | 2238 // Detach the frame before finding. |
2239 EXPECT_TRUE(mainFrame->document().getElementById("frame").remove()); | 2239 EXPECT_TRUE(mainFrame->document().getElementById("frame").remove()); |
2240 | 2240 |
2241 EXPECT_TRUE(mainFrame->find(kFindIdentifier, searchText, options, false, 0))
; | 2241 EXPECT_TRUE(mainFrame->find(kFindIdentifier, searchText, options, false, 0))
; |
2242 EXPECT_FALSE(secondFrame->find(kFindIdentifier, searchText, options, false,
0)); | 2242 EXPECT_FALSE(secondFrame->find(kFindIdentifier, searchText, options, false,
0)); |
2243 | 2243 |
2244 runPendingTasks(); | 2244 runPendingTasks(); |
2245 EXPECT_FALSE(client.findResultsAreReady()); | 2245 EXPECT_FALSE(client.findResultsAreReady()); |
(...skipping 21 matching lines...) Expand all Loading... |
2267 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "find_in_page
.html", true, &client); | 2267 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "find_in_page
.html", true, &client); |
2268 m_webView->resize(WebSize(640, 480)); | 2268 m_webView->resize(WebSize(640, 480)); |
2269 m_webView->layout(); | 2269 m_webView->layout(); |
2270 runPendingTasks(); | 2270 runPendingTasks(); |
2271 | 2271 |
2272 static const char* kFindString = "result"; | 2272 static const char* kFindString = "result"; |
2273 static const int kFindIdentifier = 12345; | 2273 static const int kFindIdentifier = 12345; |
2274 | 2274 |
2275 WebFindOptions options; | 2275 WebFindOptions options; |
2276 WebString searchText = WebString::fromUTF8(kFindString); | 2276 WebString searchText = WebString::fromUTF8(kFindString); |
2277 WebFrameImpl* mainFrame = static_cast<WebFrameImpl*>(m_webView->mainFrame())
; | 2277 WebFrameImpl* mainFrame = toWebFrameImpl(m_webView->mainFrame()); |
2278 WebFrameImpl* secondFrame = static_cast<WebFrameImpl*>(mainFrame->traverseNe
xt(false)); | 2278 WebFrameImpl* secondFrame = toWebFrameImpl(mainFrame->traverseNext(false)); |
2279 RefPtr<WebCore::Frame> holdSecondFrame = secondFrame->frame(); | 2279 RefPtr<WebCore::Frame> holdSecondFrame = secondFrame->frame(); |
2280 | 2280 |
2281 for (WebFrame* frame = mainFrame; frame; frame = frame->traverseNext(false)) | 2281 for (WebFrame* frame = mainFrame; frame; frame = frame->traverseNext(false)) |
2282 EXPECT_TRUE(frame->find(kFindIdentifier, searchText, options, false, 0))
; | 2282 EXPECT_TRUE(frame->find(kFindIdentifier, searchText, options, false, 0))
; |
2283 | 2283 |
2284 runPendingTasks(); | 2284 runPendingTasks(); |
2285 EXPECT_FALSE(client.findResultsAreReady()); | 2285 EXPECT_FALSE(client.findResultsAreReady()); |
2286 | 2286 |
2287 // Detach the frame between finding and scoping. | 2287 // Detach the frame between finding and scoping. |
2288 EXPECT_TRUE(mainFrame->document().getElementById("frame").remove()); | 2288 EXPECT_TRUE(mainFrame->document().getElementById("frame").remove()); |
(...skipping 21 matching lines...) Expand all Loading... |
2310 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "find_in_page
.html", true, &client); | 2310 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "find_in_page
.html", true, &client); |
2311 m_webView->resize(WebSize(640, 480)); | 2311 m_webView->resize(WebSize(640, 480)); |
2312 m_webView->layout(); | 2312 m_webView->layout(); |
2313 runPendingTasks(); | 2313 runPendingTasks(); |
2314 | 2314 |
2315 static const char* kFindString = "result"; | 2315 static const char* kFindString = "result"; |
2316 static const int kFindIdentifier = 12345; | 2316 static const int kFindIdentifier = 12345; |
2317 | 2317 |
2318 WebFindOptions options; | 2318 WebFindOptions options; |
2319 WebString searchText = WebString::fromUTF8(kFindString); | 2319 WebString searchText = WebString::fromUTF8(kFindString); |
2320 WebFrameImpl* mainFrame = static_cast<WebFrameImpl*>(m_webView->mainFrame())
; | 2320 WebFrameImpl* mainFrame = toWebFrameImpl(m_webView->mainFrame()); |
2321 WebFrameImpl* secondFrame = static_cast<WebFrameImpl*>(mainFrame->traverseNe
xt(false)); | 2321 WebFrameImpl* secondFrame = toWebFrameImpl(mainFrame->traverseNext(false)); |
2322 RefPtr<WebCore::Frame> holdSecondFrame = secondFrame->frame(); | 2322 RefPtr<WebCore::Frame> holdSecondFrame = secondFrame->frame(); |
2323 | 2323 |
2324 for (WebFrame* frame = mainFrame; frame; frame = frame->traverseNext(false)) | 2324 for (WebFrame* frame = mainFrame; frame; frame = frame->traverseNext(false)) |
2325 EXPECT_TRUE(frame->find(kFindIdentifier, searchText, options, false, 0))
; | 2325 EXPECT_TRUE(frame->find(kFindIdentifier, searchText, options, false, 0))
; |
2326 | 2326 |
2327 runPendingTasks(); | 2327 runPendingTasks(); |
2328 EXPECT_FALSE(client.findResultsAreReady()); | 2328 EXPECT_FALSE(client.findResultsAreReady()); |
2329 | 2329 |
2330 mainFrame->resetMatchCount(); | 2330 mainFrame->resetMatchCount(); |
2331 | 2331 |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2604 { | 2604 { |
2605 return WebCore::VisiblePosition(renderer->positionForPoint(WebCore::LayoutPo
int(x, y))).deepEquivalent().computeOffsetInContainerNode(); | 2605 return WebCore::VisiblePosition(renderer->positionForPoint(WebCore::LayoutPo
int(x, y))).deepEquivalent().computeOffsetInContainerNode(); |
2606 } | 2606 } |
2607 | 2607 |
2608 // positionForPoint returns the wrong values for contenteditable spans. See | 2608 // positionForPoint returns the wrong values for contenteditable spans. See |
2609 // http://crbug.com/238334. | 2609 // http://crbug.com/238334. |
2610 TEST_F(WebFrameTest, DISABLED_PositionForPointTest) | 2610 TEST_F(WebFrameTest, DISABLED_PositionForPointTest) |
2611 { | 2611 { |
2612 registerMockedHttpURLLoad("select_range_span_editable.html"); | 2612 registerMockedHttpURLLoad("select_range_span_editable.html"); |
2613 m_webView = createWebViewForTextSelection(m_baseURL + "select_range_span_edi
table.html"); | 2613 m_webView = createWebViewForTextSelection(m_baseURL + "select_range_span_edi
table.html"); |
2614 WebFrameImpl* mainFrame = static_cast<WebFrameImpl*>(m_webView->mainFrame())
; | 2614 WebFrameImpl* mainFrame = toWebFrameImpl(m_webView->mainFrame()); |
2615 WebCore::RenderObject* renderer = mainFrame->frame()->selection()->rootEdita
bleElement()->renderer(); | 2615 WebCore::RenderObject* renderer = mainFrame->frame()->selection()->rootEdita
bleElement()->renderer(); |
2616 EXPECT_EQ(0, computeOffset(renderer, -1, -1)); | 2616 EXPECT_EQ(0, computeOffset(renderer, -1, -1)); |
2617 EXPECT_EQ(64, computeOffset(renderer, 1000, 1000)); | 2617 EXPECT_EQ(64, computeOffset(renderer, 1000, 1000)); |
2618 | 2618 |
2619 registerMockedHttpURLLoad("select_range_div_editable.html"); | 2619 registerMockedHttpURLLoad("select_range_div_editable.html"); |
2620 m_webView = createWebViewForTextSelection(m_baseURL + "select_range_div_edit
able.html"); | 2620 m_webView = createWebViewForTextSelection(m_baseURL + "select_range_div_edit
able.html"); |
2621 mainFrame = static_cast<WebFrameImpl*>(m_webView->mainFrame()); | 2621 mainFrame = toWebFrameImpl(m_webView->mainFrame()); |
2622 renderer = mainFrame->frame()->selection()->rootEditableElement()->renderer(
); | 2622 renderer = mainFrame->frame()->selection()->rootEditableElement()->renderer(
); |
2623 EXPECT_EQ(0, computeOffset(renderer, -1, -1)); | 2623 EXPECT_EQ(0, computeOffset(renderer, -1, -1)); |
2624 EXPECT_EQ(64, computeOffset(renderer, 1000, 1000)); | 2624 EXPECT_EQ(64, computeOffset(renderer, 1000, 1000)); |
2625 } | 2625 } |
2626 | 2626 |
2627 #if !OS(DARWIN) | 2627 #if !OS(DARWIN) |
2628 TEST_F(WebFrameTest, SelectRangeStaysHorizontallyAlignedWhenMoved) | 2628 TEST_F(WebFrameTest, SelectRangeStaysHorizontallyAlignedWhenMoved) |
2629 { | 2629 { |
2630 WebFrameImpl* frame; | 2630 WebFrameImpl* frame; |
2631 registerMockedHttpURLLoad("move_caret.html"); | 2631 registerMockedHttpURLLoad("move_caret.html"); |
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3043 uint32_t m_hash; | 3043 uint32_t m_hash; |
3044 }; | 3044 }; |
3045 | 3045 |
3046 TEST_F(WebFrameTest, ReplaceMisspelledRange) | 3046 TEST_F(WebFrameTest, ReplaceMisspelledRange) |
3047 { | 3047 { |
3048 registerMockedHttpURLLoad("spell.html"); | 3048 registerMockedHttpURLLoad("spell.html"); |
3049 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "spell.html")
; | 3049 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "spell.html")
; |
3050 SpellCheckClient spellcheck; | 3050 SpellCheckClient spellcheck; |
3051 m_webView->setSpellCheckClient(&spellcheck); | 3051 m_webView->setSpellCheckClient(&spellcheck); |
3052 | 3052 |
3053 WebFrameImpl* frame = static_cast<WebFrameImpl*>(m_webView->mainFrame()); | 3053 WebFrameImpl* frame = toWebFrameImpl(m_webView->mainFrame()); |
3054 Document* document = frame->frame()->document(); | 3054 Document* document = frame->frame()->document(); |
3055 Element* element = document->getElementById("data"); | 3055 Element* element = document->getElementById("data"); |
3056 | 3056 |
3057 m_webView->settings()->setAsynchronousSpellCheckingEnabled(true); | 3057 m_webView->settings()->setAsynchronousSpellCheckingEnabled(true); |
3058 m_webView->settings()->setUnifiedTextCheckerEnabled(true); | 3058 m_webView->settings()->setUnifiedTextCheckerEnabled(true); |
3059 m_webView->settings()->setEditingBehavior(WebSettings::EditingBehaviorWin); | 3059 m_webView->settings()->setEditingBehavior(WebSettings::EditingBehaviorWin); |
3060 | 3060 |
3061 element->focus(); | 3061 element->focus(); |
3062 document->execCommand("InsertText", false, "_wellcome_."); | 3062 document->execCommand("InsertText", false, "_wellcome_."); |
3063 | 3063 |
(...skipping 12 matching lines...) Expand all Loading... |
3076 m_webView = 0; | 3076 m_webView = 0; |
3077 } | 3077 } |
3078 | 3078 |
3079 TEST_F(WebFrameTest, RemoveSpellingMarkers) | 3079 TEST_F(WebFrameTest, RemoveSpellingMarkers) |
3080 { | 3080 { |
3081 registerMockedHttpURLLoad("spell.html"); | 3081 registerMockedHttpURLLoad("spell.html"); |
3082 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "spell.html")
; | 3082 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "spell.html")
; |
3083 SpellCheckClient spellcheck; | 3083 SpellCheckClient spellcheck; |
3084 m_webView->setSpellCheckClient(&spellcheck); | 3084 m_webView->setSpellCheckClient(&spellcheck); |
3085 | 3085 |
3086 WebFrameImpl* frame = static_cast<WebFrameImpl*>(m_webView->mainFrame()); | 3086 WebFrameImpl* frame = toWebFrameImpl(m_webView->mainFrame()); |
3087 Document* document = frame->frame()->document(); | 3087 Document* document = frame->frame()->document(); |
3088 Element* element = document->getElementById("data"); | 3088 Element* element = document->getElementById("data"); |
3089 | 3089 |
3090 m_webView->settings()->setAsynchronousSpellCheckingEnabled(true); | 3090 m_webView->settings()->setAsynchronousSpellCheckingEnabled(true); |
3091 m_webView->settings()->setUnifiedTextCheckerEnabled(true); | 3091 m_webView->settings()->setUnifiedTextCheckerEnabled(true); |
3092 m_webView->settings()->setEditingBehavior(WebSettings::EditingBehaviorWin); | 3092 m_webView->settings()->setEditingBehavior(WebSettings::EditingBehaviorWin); |
3093 | 3093 |
3094 element->focus(); | 3094 element->focus(); |
3095 document->execCommand("InsertText", false, "_wellcome_."); | 3095 document->execCommand("InsertText", false, "_wellcome_."); |
3096 | 3096 |
(...skipping 11 matching lines...) Expand all Loading... |
3108 } | 3108 } |
3109 | 3109 |
3110 TEST_F(WebFrameTest, MarkerHashIdentifiers) { | 3110 TEST_F(WebFrameTest, MarkerHashIdentifiers) { |
3111 registerMockedHttpURLLoad("spell.html"); | 3111 registerMockedHttpURLLoad("spell.html"); |
3112 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "spell.html")
; | 3112 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "spell.html")
; |
3113 | 3113 |
3114 static const uint32_t kHash = 42; | 3114 static const uint32_t kHash = 42; |
3115 SpellCheckClient spellcheck(kHash); | 3115 SpellCheckClient spellcheck(kHash); |
3116 m_webView->setSpellCheckClient(&spellcheck); | 3116 m_webView->setSpellCheckClient(&spellcheck); |
3117 | 3117 |
3118 WebFrameImpl* frame = static_cast<WebFrameImpl*>(m_webView->mainFrame()); | 3118 WebFrameImpl* frame = toWebFrameImpl(m_webView->mainFrame()); |
3119 Document* document = frame->frame()->document(); | 3119 Document* document = frame->frame()->document(); |
3120 Element* element = document->getElementById("data"); | 3120 Element* element = document->getElementById("data"); |
3121 | 3121 |
3122 m_webView->settings()->setAsynchronousSpellCheckingEnabled(true); | 3122 m_webView->settings()->setAsynchronousSpellCheckingEnabled(true); |
3123 m_webView->settings()->setUnifiedTextCheckerEnabled(true); | 3123 m_webView->settings()->setUnifiedTextCheckerEnabled(true); |
3124 m_webView->settings()->setEditingBehavior(WebSettings::EditingBehaviorWin); | 3124 m_webView->settings()->setEditingBehavior(WebSettings::EditingBehaviorWin); |
3125 | 3125 |
3126 element->focus(); | 3126 element->focus(); |
3127 document->execCommand("InsertText", false, "wellcome."); | 3127 document->execCommand("InsertText", false, "wellcome."); |
3128 | 3128 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3166 }; | 3166 }; |
3167 | 3167 |
3168 TEST_F(WebFrameTest, SlowSpellcheckMarkerPosition) | 3168 TEST_F(WebFrameTest, SlowSpellcheckMarkerPosition) |
3169 { | 3169 { |
3170 registerMockedHttpURLLoad("spell.html"); | 3170 registerMockedHttpURLLoad("spell.html"); |
3171 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "spell.html")
; | 3171 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "spell.html")
; |
3172 | 3172 |
3173 StubbornSpellCheckClient spellcheck; | 3173 StubbornSpellCheckClient spellcheck; |
3174 m_webView->setSpellCheckClient(&spellcheck); | 3174 m_webView->setSpellCheckClient(&spellcheck); |
3175 | 3175 |
3176 WebFrameImpl* frame = static_cast<WebFrameImpl*>(m_webView->mainFrame()); | 3176 WebFrameImpl* frame = toWebFrameImpl(m_webView->mainFrame()); |
3177 WebInputElement webInputElement = frame->document().getElementById("data").t
o<WebInputElement>(); | 3177 WebInputElement webInputElement = frame->document().getElementById("data").t
o<WebInputElement>(); |
3178 Document* document = frame->frame()->document(); | 3178 Document* document = frame->frame()->document(); |
3179 Element* element = document->getElementById("data"); | 3179 Element* element = document->getElementById("data"); |
3180 | 3180 |
3181 m_webView->settings()->setAsynchronousSpellCheckingEnabled(true); | 3181 m_webView->settings()->setAsynchronousSpellCheckingEnabled(true); |
3182 m_webView->settings()->setUnifiedTextCheckerEnabled(true); | 3182 m_webView->settings()->setUnifiedTextCheckerEnabled(true); |
3183 m_webView->settings()->setEditingBehavior(WebSettings::EditingBehaviorWin); | 3183 m_webView->settings()->setEditingBehavior(WebSettings::EditingBehaviorWin); |
3184 | 3184 |
3185 element->focus(); | 3185 element->focus(); |
3186 document->execCommand("InsertText", false, "wellcome "); | 3186 document->execCommand("InsertText", false, "wellcome "); |
(...skipping 11 matching lines...) Expand all Loading... |
3198 } | 3198 } |
3199 | 3199 |
3200 // This test verifies that cancelling spelling request does not cause a | 3200 // This test verifies that cancelling spelling request does not cause a |
3201 // write-after-free when there's no spellcheck client set. | 3201 // write-after-free when there's no spellcheck client set. |
3202 TEST_F(WebFrameTest, CancelSpellingRequestCrash) | 3202 TEST_F(WebFrameTest, CancelSpellingRequestCrash) |
3203 { | 3203 { |
3204 registerMockedHttpURLLoad("spell.html"); | 3204 registerMockedHttpURLLoad("spell.html"); |
3205 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "spell.html")
; | 3205 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "spell.html")
; |
3206 m_webView->setSpellCheckClient(0); | 3206 m_webView->setSpellCheckClient(0); |
3207 | 3207 |
3208 WebFrameImpl* frame = static_cast<WebFrameImpl*>(m_webView->mainFrame()); | 3208 WebFrameImpl* frame = toWebFrameImpl(m_webView->mainFrame()); |
3209 Document* document = frame->frame()->document(); | 3209 Document* document = frame->frame()->document(); |
3210 Element* element = document->getElementById("data"); | 3210 Element* element = document->getElementById("data"); |
3211 | 3211 |
3212 m_webView->settings()->setAsynchronousSpellCheckingEnabled(true); | 3212 m_webView->settings()->setAsynchronousSpellCheckingEnabled(true); |
3213 m_webView->settings()->setUnifiedTextCheckerEnabled(true); | 3213 m_webView->settings()->setUnifiedTextCheckerEnabled(true); |
3214 m_webView->settings()->setEditingBehavior(WebSettings::EditingBehaviorWin); | 3214 m_webView->settings()->setEditingBehavior(WebSettings::EditingBehaviorWin); |
3215 | 3215 |
3216 element->focus(); | 3216 element->focus(); |
3217 frame->frame()->editor().replaceSelectionWithText("A", false, false); | 3217 frame->frame()->editor().replaceSelectionWithText("A", false, false); |
3218 frame->frame()->editor().spellCheckRequester().cancelCheck(); | 3218 frame->frame()->editor().spellCheckRequester().cancelCheck(); |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3316 } | 3316 } |
3317 bool wasUserScroll() const { return m_didScrollMainFrame && !m_wasProgrammat
icScroll; } | 3317 bool wasUserScroll() const { return m_didScrollMainFrame && !m_wasProgrammat
icScroll; } |
3318 bool wasProgrammaticScroll() const { return m_didScrollMainFrame && m_wasPro
grammaticScroll; } | 3318 bool wasProgrammaticScroll() const { return m_didScrollMainFrame && m_wasPro
grammaticScroll; } |
3319 | 3319 |
3320 // WebFrameClient: | 3320 // WebFrameClient: |
3321 virtual void didChangeScrollOffset(WebFrame* frame) OVERRIDE | 3321 virtual void didChangeScrollOffset(WebFrame* frame) OVERRIDE |
3322 { | 3322 { |
3323 if (frame->parent()) | 3323 if (frame->parent()) |
3324 return; | 3324 return; |
3325 EXPECT_FALSE(m_didScrollMainFrame); | 3325 EXPECT_FALSE(m_didScrollMainFrame); |
3326 WebCore::FrameView* view = static_cast<WebFrameImpl*>(frame)->frameView(
); | 3326 WebCore::FrameView* view = toWebFrameImpl(frame)->frameView(); |
3327 // FrameView can be scrolled in FrameView::setFixedVisibleContentRect | 3327 // FrameView can be scrolled in FrameView::setFixedVisibleContentRect |
3328 // which is called from Frame::createView (before the frame is associate
d | 3328 // which is called from Frame::createView (before the frame is associate
d |
3329 // with the the view). | 3329 // with the the view). |
3330 if (view) { | 3330 if (view) { |
3331 m_didScrollMainFrame = true; | 3331 m_didScrollMainFrame = true; |
3332 m_wasProgrammaticScroll = view->inProgrammaticScroll(); | 3332 m_wasProgrammaticScroll = view->inProgrammaticScroll(); |
3333 } | 3333 } |
3334 } | 3334 } |
3335 private: | 3335 private: |
3336 bool m_didScrollMainFrame; | 3336 bool m_didScrollMainFrame; |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3501 | 3501 |
3502 class TestSameDocumentWebFrameClient : public WebFrameClient { | 3502 class TestSameDocumentWebFrameClient : public WebFrameClient { |
3503 public: | 3503 public: |
3504 TestSameDocumentWebFrameClient() | 3504 TestSameDocumentWebFrameClient() |
3505 : m_frameLoadTypeSameSeen(false) | 3505 : m_frameLoadTypeSameSeen(false) |
3506 { | 3506 { |
3507 } | 3507 } |
3508 | 3508 |
3509 virtual void willSendRequest(WebFrame* frame, unsigned, WebURLRequest&, cons
t WebURLResponse&) | 3509 virtual void willSendRequest(WebFrame* frame, unsigned, WebURLRequest&, cons
t WebURLResponse&) |
3510 { | 3510 { |
3511 if (static_cast<WebFrameImpl*>(frame)->frame()->loader()->loadType() ==
WebCore::FrameLoadTypeSame) | 3511 if (toWebFrameImpl(frame)->frame()->loader()->loadType() == WebCore::Fra
meLoadTypeSame) |
3512 m_frameLoadTypeSameSeen = true; | 3512 m_frameLoadTypeSameSeen = true; |
3513 } | 3513 } |
3514 | 3514 |
3515 bool frameLoadTypeSameSeen() const { return m_frameLoadTypeSameSeen; } | 3515 bool frameLoadTypeSameSeen() const { return m_frameLoadTypeSameSeen; } |
3516 | 3516 |
3517 private: | 3517 private: |
3518 bool m_frameLoadTypeSameSeen; | 3518 bool m_frameLoadTypeSameSeen; |
3519 }; | 3519 }; |
3520 | 3520 |
3521 TEST_F(WebFrameTest, NavigateToSame) | 3521 TEST_F(WebFrameTest, NavigateToSame) |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3593 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "push_state.h
tml", true, 0, &client); | 3593 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "push_state.h
tml", true, 0, &client); |
3594 runPendingTasks(); | 3594 runPendingTasks(); |
3595 | 3595 |
3596 EXPECT_EQ(client.startLoadingCount(), 2); | 3596 EXPECT_EQ(client.startLoadingCount(), 2); |
3597 EXPECT_EQ(client.stopLoadingCount(), 2); | 3597 EXPECT_EQ(client.stopLoadingCount(), 2); |
3598 m_webView->close(); | 3598 m_webView->close(); |
3599 m_webView = 0; | 3599 m_webView = 0; |
3600 } | 3600 } |
3601 | 3601 |
3602 } // namespace | 3602 } // namespace |
OLD | NEW |