Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(282)

Side by Side Diff: third_party/WebKit/Source/web/tests/WebFrameTest.cpp

Issue 1990553002: Remove RenderViewImpl::GetFocusedElement. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Made Windows happy and brought back bool return because fake tests. Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 2943 matching lines...) Expand 10 before | Expand all | Expand 10 after
2954 webViewHelper.webViewImpl()->enableFakePageScaleAnimationForTesting(true); 2954 webViewHelper.webViewImpl()->enableFakePageScaleAnimationForTesting(true);
2955 webViewHelper.webViewImpl()->page()->settings().setTextAutosizingEnabled(fal se); 2955 webViewHelper.webViewImpl()->page()->settings().setTextAutosizingEnabled(fal se);
2956 webViewHelper.webViewImpl()->settings()->setAutoZoomFocusedNodeToLegibleScal e(true); 2956 webViewHelper.webViewImpl()->settings()->setAutoZoomFocusedNodeToLegibleScal e(true);
2957 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); 2957 webViewHelper.resize(WebSize(viewportWidth, viewportHeight));
2958 2958
2959 float initialScale = webViewHelper.webViewImpl()->pageScaleFactor(); 2959 float initialScale = webViewHelper.webViewImpl()->pageScaleFactor();
2960 2960
2961 // Focus the first textbox that's in a touch-action: pan-x ancestor, this 2961 // Focus the first textbox that's in a touch-action: pan-x ancestor, this
2962 // shouldn't cause an autozoom since pan-x disables pinch-zoom. 2962 // shouldn't cause an autozoom since pan-x disables pinch-zoom.
2963 webViewHelper.webViewImpl()->advanceFocus(false); 2963 webViewHelper.webViewImpl()->advanceFocus(false);
2964 webViewHelper.webViewImpl()->scrollFocusedNodeIntoRect(WebRect()); 2964 webViewHelper.webViewImpl()->scrollFocusedEditableElementIntoRect(WebRect()) ;
2965 EXPECT_EQ(webViewHelper.webViewImpl()->fakePageScaleAnimationPageScaleForTes ting(), 0); 2965 EXPECT_EQ(webViewHelper.webViewImpl()->fakePageScaleAnimationPageScaleForTes ting(), 0);
2966 2966
2967 setScaleAndScrollAndLayout(webViewHelper.webViewImpl(), WebPoint(0, 0), init ialScale); 2967 setScaleAndScrollAndLayout(webViewHelper.webViewImpl(), WebPoint(0, 0), init ialScale);
2968 ASSERT_EQ(initialScale, webViewHelper.webViewImpl()->pageScaleFactor()); 2968 ASSERT_EQ(initialScale, webViewHelper.webViewImpl()->pageScaleFactor());
2969 2969
2970 // Focus the second textbox that's in a touch-action: manipulation ancestor, 2970 // Focus the second textbox that's in a touch-action: manipulation ancestor,
2971 // this should cause an autozoom since it allows pinch-zoom. 2971 // this should cause an autozoom since it allows pinch-zoom.
2972 webViewHelper.webViewImpl()->advanceFocus(false); 2972 webViewHelper.webViewImpl()->advanceFocus(false);
2973 webViewHelper.webViewImpl()->scrollFocusedNodeIntoRect(WebRect()); 2973 webViewHelper.webViewImpl()->scrollFocusedEditableElementIntoRect(WebRect()) ;
2974 EXPECT_GT(webViewHelper.webViewImpl()->fakePageScaleAnimationPageScaleForTes ting(), initialScale); 2974 EXPECT_GT(webViewHelper.webViewImpl()->fakePageScaleAnimationPageScaleForTes ting(), initialScale);
2975 2975
2976 setScaleAndScrollAndLayout(webViewHelper.webViewImpl(), WebPoint(0, 0), init ialScale); 2976 setScaleAndScrollAndLayout(webViewHelper.webViewImpl(), WebPoint(0, 0), init ialScale);
2977 ASSERT_EQ(initialScale, webViewHelper.webViewImpl()->pageScaleFactor()); 2977 ASSERT_EQ(initialScale, webViewHelper.webViewImpl()->pageScaleFactor());
2978 2978
2979 // Focus the third textbox that has a touch-action: pan-x ancestor, this 2979 // Focus the third textbox that has a touch-action: pan-x ancestor, this
2980 // should cause an autozoom since it's seperated from the node with the 2980 // should cause an autozoom since it's seperated from the node with the
2981 // touch-action by an overflow:scroll element. 2981 // touch-action by an overflow:scroll element.
2982 webViewHelper.webView()->advanceFocus(false); 2982 webViewHelper.webView()->advanceFocus(false);
2983 webViewHelper.webViewImpl()->scrollFocusedNodeIntoRect(WebRect()); 2983 webViewHelper.webViewImpl()->scrollFocusedEditableElementIntoRect(WebRect()) ;
2984 EXPECT_GT(webViewHelper.webViewImpl()->fakePageScaleAnimationPageScaleForTes ting(), initialScale); 2984 EXPECT_GT(webViewHelper.webViewImpl()->fakePageScaleAnimationPageScaleForTes ting(), initialScale);
2985 } 2985 }
2986 2986
2987 2987
2988 TEST_F(WebFrameTest, DivScrollIntoEditableTest) 2988 TEST_F(WebFrameTest, DivScrollIntoEditableTest)
2989 { 2989 {
2990 registerMockedHttpURLLoad("get_scale_for_zoom_into_editable_test.html"); 2990 registerMockedHttpURLLoad("get_scale_for_zoom_into_editable_test.html");
2991 2991
2992 const bool autoZoomToLegibleScale = true; 2992 const bool autoZoomToLegibleScale = true;
2993 int viewportWidth = 450; 2993 int viewportWidth = 450;
(...skipping 5690 matching lines...) Expand 10 before | Expand all | Expand 10 after
8684 WebLocalFrame* mainFrame = helper.webView()->mainFrame()->toWebLocalFrame(); 8684 WebLocalFrame* mainFrame = helper.webView()->mainFrame()->toWebLocalFrame();
8685 v8::HandleScope scope(v8::Isolate::GetCurrent()); 8685 v8::HandleScope scope(v8::Isolate::GetCurrent());
8686 mainFrame->executeScript(WebScriptSource("hello = 'world';")); 8686 mainFrame->executeScript(WebScriptSource("hello = 'world';"));
8687 FrameTestHelpers::loadFrame(mainFrame, "data:text/html,new page"); 8687 FrameTestHelpers::loadFrame(mainFrame, "data:text/html,new page");
8688 v8::Local<v8::Value> result = mainFrame->executeScriptAndReturnValue(WebScri ptSource("hello")); 8688 v8::Local<v8::Value> result = mainFrame->executeScriptAndReturnValue(WebScri ptSource("hello"));
8689 ASSERT_TRUE(result->IsString()); 8689 ASSERT_TRUE(result->IsString());
8690 EXPECT_EQ("world", toCoreString(result->ToString(mainFrame->mainWorldScriptC ontext()).ToLocalChecked())); 8690 EXPECT_EQ("world", toCoreString(result->ToString(mainFrame->mainWorldScriptC ontext()).ToLocalChecked()));
8691 } 8691 }
8692 8692
8693 } // namespace blink 8693 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/tests/VisualViewportTest.cpp ('k') | third_party/WebKit/public/platform/WebLayerTreeView.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698