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 24 matching lines...) Expand all Loading... |
35 #include "core/dom/Element.h" | 35 #include "core/dom/Element.h" |
36 #include "core/editing/FrameSelection.h" | 36 #include "core/editing/FrameSelection.h" |
37 #include "core/editing/InputMethodController.h" | 37 #include "core/editing/InputMethodController.h" |
38 #include "core/editing/markers/DocumentMarkerController.h" | 38 #include "core/editing/markers/DocumentMarkerController.h" |
39 #include "core/frame/EventHandlerRegistry.h" | 39 #include "core/frame/EventHandlerRegistry.h" |
40 #include "core/frame/FrameHost.h" | 40 #include "core/frame/FrameHost.h" |
41 #include "core/frame/FrameView.h" | 41 #include "core/frame/FrameView.h" |
42 #include "core/frame/LocalFrame.h" | 42 #include "core/frame/LocalFrame.h" |
43 #include "core/frame/Settings.h" | 43 #include "core/frame/Settings.h" |
44 #include "core/frame/VisualViewport.h" | 44 #include "core/frame/VisualViewport.h" |
45 #include "core/html/HTMLDocument.h" | |
46 #include "core/html/HTMLIFrameElement.h" | 45 #include "core/html/HTMLIFrameElement.h" |
47 #include "core/html/HTMLInputElement.h" | 46 #include "core/html/HTMLInputElement.h" |
48 #include "core/html/HTMLTextAreaElement.h" | 47 #include "core/html/HTMLTextAreaElement.h" |
49 #include "core/layout/LayoutView.h" | 48 #include "core/layout/LayoutView.h" |
50 #include "core/loader/DocumentLoader.h" | 49 #include "core/loader/DocumentLoader.h" |
51 #include "core/loader/FrameLoadRequest.h" | 50 #include "core/loader/FrameLoadRequest.h" |
52 #include "core/page/Page.h" | 51 #include "core/page/Page.h" |
53 #include "core/page/ScopedPageLoadDeferrer.h" | 52 #include "core/page/ScopedPageLoadDeferrer.h" |
54 #include "core/paint/PaintLayer.h" | 53 #include "core/paint/PaintLayer.h" |
55 #include "core/paint/PaintLayerPainter.h" | 54 #include "core/paint/PaintLayerPainter.h" |
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
457 TEST_F(WebViewTest, FocusIsInactive) | 456 TEST_F(WebViewTest, FocusIsInactive) |
458 { | 457 { |
459 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), "visible_iframe.html"); | 458 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), "visible_iframe.html"); |
460 WebViewImpl* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "visibl
e_iframe.html"); | 459 WebViewImpl* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "visibl
e_iframe.html"); |
461 | 460 |
462 webView->setFocus(true); | 461 webView->setFocus(true); |
463 webView->setIsActive(true); | 462 webView->setIsActive(true); |
464 WebLocalFrameImpl* frame = webView->mainFrameImpl(); | 463 WebLocalFrameImpl* frame = webView->mainFrameImpl(); |
465 EXPECT_TRUE(frame->frame()->document()->isHTMLDocument()); | 464 EXPECT_TRUE(frame->frame()->document()->isHTMLDocument()); |
466 | 465 |
467 HTMLDocument* document = toHTMLDocument(frame->frame()->document()); | 466 Document* document = frame->frame()->document(); |
468 EXPECT_TRUE(document->hasFocus()); | 467 EXPECT_TRUE(document->hasFocus()); |
469 webView->setFocus(false); | 468 webView->setFocus(false); |
470 webView->setIsActive(false); | 469 webView->setIsActive(false); |
471 EXPECT_FALSE(document->hasFocus()); | 470 EXPECT_FALSE(document->hasFocus()); |
472 webView->setFocus(true); | 471 webView->setFocus(true); |
473 webView->setIsActive(true); | 472 webView->setIsActive(true); |
474 EXPECT_TRUE(document->hasFocus()); | 473 EXPECT_TRUE(document->hasFocus()); |
475 webView->setFocus(true); | 474 webView->setFocus(true); |
476 webView->setIsActive(false); | 475 webView->setIsActive(false); |
477 EXPECT_FALSE(document->hasFocus()); | 476 EXPECT_FALSE(document->hasFocus()); |
(...skipping 2213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2691 // This test verifies the text input flags are correctly exposed to script. | 2690 // This test verifies the text input flags are correctly exposed to script. |
2692 TEST_F(WebViewTest, TextInputFlags) | 2691 TEST_F(WebViewTest, TextInputFlags) |
2693 { | 2692 { |
2694 NonUserInputTextUpdateWebViewClient client; | 2693 NonUserInputTextUpdateWebViewClient client; |
2695 std::string url = m_baseURL + "text_input_flags.html"; | 2694 std::string url = m_baseURL + "text_input_flags.html"; |
2696 URLTestHelpers::registerMockedURLLoad(toKURL(url), "text_input_flags.html"); | 2695 URLTestHelpers::registerMockedURLLoad(toKURL(url), "text_input_flags.html"); |
2697 WebViewImpl* webViewImpl = m_webViewHelper.initializeAndLoad(url, true, 0, &
client); | 2696 WebViewImpl* webViewImpl = m_webViewHelper.initializeAndLoad(url, true, 0, &
client); |
2698 webViewImpl->setInitialFocus(false); | 2697 webViewImpl->setInitialFocus(false); |
2699 | 2698 |
2700 WebLocalFrameImpl* frame = webViewImpl->mainFrameImpl(); | 2699 WebLocalFrameImpl* frame = webViewImpl->mainFrameImpl(); |
2701 HTMLDocument* document = toHTMLDocument(frame->frame()->document()); | 2700 Document* document = frame->frame()->document(); |
2702 | 2701 |
2703 // (A) <input> | 2702 // (A) <input> |
2704 // (A.1) Verifies autocorrect/autocomplete/spellcheck flags are Off and | 2703 // (A.1) Verifies autocorrect/autocomplete/spellcheck flags are Off and |
2705 // autocapitalize is set to none. | 2704 // autocapitalize is set to none. |
2706 HTMLInputElement* inputElement = toHTMLInputElement(document->getElementById
("input")); | 2705 HTMLInputElement* inputElement = toHTMLInputElement(document->getElementById
("input")); |
2707 document->setFocusedElement(inputElement, FocusParams(SelectionBehaviorOnFoc
us::None, WebFocusTypeNone, nullptr)); | 2706 document->setFocusedElement(inputElement, FocusParams(SelectionBehaviorOnFoc
us::None, WebFocusTypeNone, nullptr)); |
2708 webViewImpl->setFocus(true); | 2707 webViewImpl->setFocus(true); |
2709 WebTextInputInfo info1 = webViewImpl->textInputInfo(); | 2708 WebTextInputInfo info1 = webViewImpl->textInputInfo(); |
2710 EXPECT_EQ( | 2709 EXPECT_EQ( |
2711 WebTextInputFlagAutocompleteOff | WebTextInputFlagAutocorrectOff | WebTe
xtInputFlagSpellcheckOff | WebTextInputFlagAutocapitalizeNone, | 2710 WebTextInputFlagAutocompleteOff | WebTextInputFlagAutocorrectOff | WebTe
xtInputFlagSpellcheckOff | WebTextInputFlagAutocapitalizeNone, |
(...skipping 29 matching lines...) Expand all Loading... |
2741 // called iff value of a focused element is modified via script. | 2740 // called iff value of a focused element is modified via script. |
2742 TEST_F(WebViewTest, NonUserInputTextUpdate) | 2741 TEST_F(WebViewTest, NonUserInputTextUpdate) |
2743 { | 2742 { |
2744 NonUserInputTextUpdateWebViewClient client; | 2743 NonUserInputTextUpdateWebViewClient client; |
2745 std::string url = m_baseURL + "non_user_input_text_update.html"; | 2744 std::string url = m_baseURL + "non_user_input_text_update.html"; |
2746 URLTestHelpers::registerMockedURLLoad(toKURL(url), "non_user_input_text_upda
te.html"); | 2745 URLTestHelpers::registerMockedURLLoad(toKURL(url), "non_user_input_text_upda
te.html"); |
2747 WebViewImpl* webViewImpl = m_webViewHelper.initializeAndLoad(url, true, 0, &
client); | 2746 WebViewImpl* webViewImpl = m_webViewHelper.initializeAndLoad(url, true, 0, &
client); |
2748 webViewImpl->setInitialFocus(false); | 2747 webViewImpl->setInitialFocus(false); |
2749 | 2748 |
2750 WebLocalFrameImpl* frame = webViewImpl->mainFrameImpl(); | 2749 WebLocalFrameImpl* frame = webViewImpl->mainFrameImpl(); |
2751 HTMLDocument* document = toHTMLDocument(frame->frame()->document()); | 2750 Document* document = frame->frame()->document(); |
2752 | 2751 |
2753 // (A) <input> | 2752 // (A) <input> |
2754 // (A.1) Focused and value is changed by script. | 2753 // (A.1) Focused and value is changed by script. |
2755 client.reset(); | 2754 client.reset(); |
2756 EXPECT_FALSE(client.textIsUpdated()); | 2755 EXPECT_FALSE(client.textIsUpdated()); |
2757 | 2756 |
2758 HTMLInputElement* inputElement = toHTMLInputElement(document->getElementById
("input")); | 2757 HTMLInputElement* inputElement = toHTMLInputElement(document->getElementById
("input")); |
2759 document->setFocusedElement(inputElement, FocusParams(SelectionBehaviorOnFoc
us::None, WebFocusTypeNone, nullptr)); | 2758 document->setFocusedElement(inputElement, FocusParams(SelectionBehaviorOnFoc
us::None, WebFocusTypeNone, nullptr)); |
2760 webViewImpl->setFocus(true); | 2759 webViewImpl->setFocus(true); |
2761 EXPECT_EQ(document->focusedElement(), static_cast<Element*>(inputElement)); | 2760 EXPECT_EQ(document->focusedElement(), static_cast<Element*>(inputElement)); |
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3249 EXPECT_TRUE(webView->page()->defersLoading()); | 3248 EXPECT_TRUE(webView->page()->defersLoading()); |
3250 } | 3249 } |
3251 | 3250 |
3252 EXPECT_TRUE(webView->page()->defersLoading()); | 3251 EXPECT_TRUE(webView->page()->defersLoading()); |
3253 } | 3252 } |
3254 | 3253 |
3255 EXPECT_FALSE(webView->page()->defersLoading()); | 3254 EXPECT_FALSE(webView->page()->defersLoading()); |
3256 } | 3255 } |
3257 | 3256 |
3258 } // namespace blink | 3257 } // namespace blink |
OLD | NEW |