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

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

Issue 2896563002: Update WebLocalFrameImpl with WebLocalFrameBase to break dependencies. (Closed)
Patch Set: Rebase Created 3 years, 6 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 #include "core/editing/markers/DocumentMarkerController.h" 57 #include "core/editing/markers/DocumentMarkerController.h"
58 #include "core/editing/spellcheck/IdleSpellCheckCallback.h" 58 #include "core/editing/spellcheck/IdleSpellCheckCallback.h"
59 #include "core/editing/spellcheck/SpellChecker.h" 59 #include "core/editing/spellcheck/SpellChecker.h"
60 #include "core/events/MouseEvent.h" 60 #include "core/events/MouseEvent.h"
61 #include "core/exported/WebViewBase.h" 61 #include "core/exported/WebViewBase.h"
62 #include "core/frame/FrameView.h" 62 #include "core/frame/FrameView.h"
63 #include "core/frame/LocalFrame.h" 63 #include "core/frame/LocalFrame.h"
64 #include "core/frame/RemoteFrame.h" 64 #include "core/frame/RemoteFrame.h"
65 #include "core/frame/Settings.h" 65 #include "core/frame/Settings.h"
66 #include "core/frame/VisualViewport.h" 66 #include "core/frame/VisualViewport.h"
67 #include "core/frame/WebLocalFrameBase.h"
67 #include "core/html/HTMLBodyElement.h" 68 #include "core/html/HTMLBodyElement.h"
68 #include "core/html/HTMLFormElement.h" 69 #include "core/html/HTMLFormElement.h"
69 #include "core/html/HTMLIFrameElement.h" 70 #include "core/html/HTMLIFrameElement.h"
70 #include "core/html/HTMLVideoElement.h" 71 #include "core/html/HTMLVideoElement.h"
71 #include "core/html/ImageDocument.h" 72 #include "core/html/ImageDocument.h"
72 #include "core/input/EventHandler.h" 73 #include "core/input/EventHandler.h"
73 #include "core/layout/HitTestResult.h" 74 #include "core/layout/HitTestResult.h"
74 #include "core/layout/LayoutFullScreen.h" 75 #include "core/layout/LayoutFullScreen.h"
75 #include "core/layout/api/LayoutViewItem.h" 76 #include "core/layout/api/LayoutViewItem.h"
76 #include "core/layout/compositing/PaintLayerCompositor.h" 77 #include "core/layout/compositing/PaintLayerCompositor.h"
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 #include "public/web/WebSelection.h" 148 #include "public/web/WebSelection.h"
148 #include "public/web/WebSettings.h" 149 #include "public/web/WebSettings.h"
149 #include "public/web/WebTextCheckClient.h" 150 #include "public/web/WebTextCheckClient.h"
150 #include "public/web/WebTextCheckingCompletion.h" 151 #include "public/web/WebTextCheckingCompletion.h"
151 #include "public/web/WebTextCheckingResult.h" 152 #include "public/web/WebTextCheckingResult.h"
152 #include "public/web/WebViewClient.h" 153 #include "public/web/WebViewClient.h"
153 #include "testing/gmock/include/gmock/gmock.h" 154 #include "testing/gmock/include/gmock/gmock.h"
154 #include "testing/gtest/include/gtest/gtest.h" 155 #include "testing/gtest/include/gtest/gtest.h"
155 #include "v8/include/v8.h" 156 #include "v8/include/v8.h"
156 #include "web/TextFinder.h" 157 #include "web/TextFinder.h"
157 #include "web/WebLocalFrameImpl.h"
158 #include "web/WebRemoteFrameImpl.h" 158 #include "web/WebRemoteFrameImpl.h"
159 #include "web/tests/FrameTestHelpers.h" 159 #include "web/tests/FrameTestHelpers.h"
160 #include "web/tests/sim/SimDisplayItemList.h" 160 #include "web/tests/sim/SimDisplayItemList.h"
161 #include "web/tests/sim/SimRequest.h" 161 #include "web/tests/sim/SimRequest.h"
162 #include "web/tests/sim/SimTest.h" 162 #include "web/tests/sim/SimTest.h"
163 163
164 using blink::URLTestHelpers::ToKURL; 164 using blink::URLTestHelpers::ToKURL;
165 using blink::testing::RunPendingTasks; 165 using blink::testing::RunPendingTasks;
166 using testing::ElementsAre; 166 using testing::ElementsAre;
167 using testing::Mock; 167 using testing::Mock;
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 RegisterMockedHttpURLLoad("nodeimage.html"); 285 RegisterMockedHttpURLLoad("nodeimage.html");
286 web_view_helper->InitializeAndLoad(base_url_ + "nodeimage.html"); 286 web_view_helper->InitializeAndLoad(base_url_ + "nodeimage.html");
287 web_view_helper->Resize(WebSize(640, 480)); 287 web_view_helper->Resize(WebSize(640, 480));
288 LocalFrame* frame = 288 LocalFrame* frame =
289 ToLocalFrame(web_view_helper->WebView()->GetPage()->MainFrame()); 289 ToLocalFrame(web_view_helper->WebView()->GetPage()->MainFrame());
290 DCHECK(frame); 290 DCHECK(frame);
291 Element* element = frame->GetDocument()->getElementById(testcase.c_str()); 291 Element* element = frame->GetDocument()->getElementById(testcase.c_str());
292 return frame->NodeImage(*element); 292 return frame->NodeImage(*element);
293 } 293 }
294 294
295 void RemoveElementById(WebLocalFrameImpl* frame, const AtomicString& id) { 295 void RemoveElementById(WebLocalFrameBase* frame, const AtomicString& id) {
296 Element* element = frame->GetFrame()->GetDocument()->getElementById(id); 296 Element* element = frame->GetFrame()->GetDocument()->getElementById(id);
297 DCHECK(element); 297 DCHECK(element);
298 element->remove(); 298 element->remove();
299 } 299 }
300 300
301 // Both sets the inner html and runs the document lifecycle. 301 // Both sets the inner html and runs the document lifecycle.
302 void InitializeWithHTML(LocalFrame& frame, const String& html_content) { 302 void InitializeWithHTML(LocalFrame& frame, const String& html_content) {
303 frame.GetDocument()->body()->setInnerHTML(html_content); 303 frame.GetDocument()->body()->setInnerHTML(html_content);
304 frame.GetDocument()->View()->UpdateAllLifecyclePhases(); 304 frame.GetDocument()->View()->UpdateAllLifecyclePhases();
305 } 305 }
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 523
524 auto callback = [](const v8::FunctionCallbackInfo<v8::Value>& info) { 524 auto callback = [](const v8::FunctionCallbackInfo<v8::Value>& info) {
525 info.GetReturnValue().Set(V8String(info.GetIsolate(), "hello")); 525 info.GetReturnValue().Set(V8String(info.GetIsolate(), "hello"));
526 }; 526 };
527 527
528 v8::HandleScope scope(v8::Isolate::GetCurrent()); 528 v8::HandleScope scope(v8::Isolate::GetCurrent());
529 v8::Local<v8::Context> context = 529 v8::Local<v8::Context> context =
530 web_view_helper.WebView()->MainFrame()->MainWorldScriptContext(); 530 web_view_helper.WebView()->MainFrame()->MainWorldScriptContext();
531 531
532 // Suspend scheduled tasks so the script doesn't run. 532 // Suspend scheduled tasks so the script doesn't run.
533 WebLocalFrameImpl* main_frame = web_view_helper.WebView()->MainFrameImpl(); 533 WebLocalFrameBase* main_frame = web_view_helper.WebView()->MainFrameImpl();
534 main_frame->GetFrame()->GetDocument()->SuspendScheduledTasks(); 534 main_frame->GetFrame()->GetDocument()->SuspendScheduledTasks();
535 535
536 ScriptExecutionCallbackHelper callback_helper(context); 536 ScriptExecutionCallbackHelper callback_helper(context);
537 v8::Local<v8::Function> function = 537 v8::Local<v8::Function> function =
538 v8::Function::New(context, callback).ToLocalChecked(); 538 v8::Function::New(context, callback).ToLocalChecked();
539 main_frame->RequestExecuteV8Function(context, function, 539 main_frame->RequestExecuteV8Function(context, function,
540 v8::Undefined(context->GetIsolate()), 0, 540 v8::Undefined(context->GetIsolate()), 0,
541 nullptr, &callback_helper); 541 nullptr, &callback_helper);
542 RunPendingTasks(); 542 RunPendingTasks();
543 EXPECT_FALSE(callback_helper.DidComplete()); 543 EXPECT_FALSE(callback_helper.DidComplete());
(...skipping 10 matching lines...) Expand all
554 554
555 FrameTestHelpers::WebViewHelper web_view_helper; 555 FrameTestHelpers::WebViewHelper web_view_helper;
556 web_view_helper.InitializeAndLoad(base_url_ + "foo.html", true); 556 web_view_helper.InitializeAndLoad(base_url_ + "foo.html", true);
557 557
558 auto callback = [](const v8::FunctionCallbackInfo<v8::Value>& info) { 558 auto callback = [](const v8::FunctionCallbackInfo<v8::Value>& info) {
559 info.GetReturnValue().Set(v8::Boolean::New( 559 info.GetReturnValue().Set(v8::Boolean::New(
560 info.GetIsolate(), UserGestureIndicator::ProcessingUserGesture())); 560 info.GetIsolate(), UserGestureIndicator::ProcessingUserGesture()));
561 }; 561 };
562 562
563 // Suspend scheduled tasks so the script doesn't run. 563 // Suspend scheduled tasks so the script doesn't run.
564 WebLocalFrameImpl* main_frame = web_view_helper.WebView()->MainFrameImpl(); 564 WebLocalFrameBase* main_frame = web_view_helper.WebView()->MainFrameImpl();
565 Document* document = main_frame->GetFrame()->GetDocument(); 565 Document* document = main_frame->GetFrame()->GetDocument();
566 document->SuspendScheduledTasks(); 566 document->SuspendScheduledTasks();
567 567
568 v8::HandleScope scope(v8::Isolate::GetCurrent()); 568 v8::HandleScope scope(v8::Isolate::GetCurrent());
569 v8::Local<v8::Context> context = 569 v8::Local<v8::Context> context =
570 web_view_helper.WebView()->MainFrame()->MainWorldScriptContext(); 570 web_view_helper.WebView()->MainFrame()->MainWorldScriptContext();
571 571
572 std::unique_ptr<UserGestureIndicator> indicator = 572 std::unique_ptr<UserGestureIndicator> indicator =
573 WTF::WrapUnique(new UserGestureIndicator(DocumentUserGestureToken::Create( 573 WTF::WrapUnique(new UserGestureIndicator(DocumentUserGestureToken::Create(
574 document, UserGestureToken::kNewGesture))); 574 document, UserGestureToken::kNewGesture)));
(...skipping 1411 matching lines...) Expand 10 before | Expand all | Expand 10 after
1986 // set view height to zero so that if the height of the view is not 1986 // set view height to zero so that if the height of the view is not
1987 // successfully updated during later resizes touch events will fail 1987 // successfully updated during later resizes touch events will fail
1988 // (as in not hit content included in the view) 1988 // (as in not hit content included in the view)
1989 web_view_helper.Resize(WebSize(viewport_width, 0)); 1989 web_view_helper.Resize(WebSize(viewport_width, 0));
1990 1990
1991 web_view_helper.WebView()->GetSettings()->SetForceZeroLayoutHeight(true); 1991 web_view_helper.WebView()->GetSettings()->SetForceZeroLayoutHeight(true);
1992 web_view_helper.Resize(WebSize(viewport_width, viewport_height)); 1992 web_view_helper.Resize(WebSize(viewport_width, viewport_height));
1993 1993
1994 IntPoint hit_point = IntPoint(30, 30); // button size is 100x100 1994 IntPoint hit_point = IntPoint(30, 30); // button size is 100x100
1995 1995
1996 WebLocalFrameImpl* frame = web_view_helper.WebView()->MainFrameImpl(); 1996 WebLocalFrameBase* frame = web_view_helper.WebView()->MainFrameImpl();
1997 Document* document = frame->GetFrame()->GetDocument(); 1997 Document* document = frame->GetFrame()->GetDocument();
1998 Element* element = document->getElementById("tap_button"); 1998 Element* element = document->getElementById("tap_button");
1999 1999
2000 ASSERT_NE(nullptr, element); 2000 ASSERT_NE(nullptr, element);
2001 EXPECT_EQ(String("oldValue"), element->innerText()); 2001 EXPECT_EQ(String("oldValue"), element->innerText());
2002 2002
2003 WebGestureEvent gesture_event(WebInputEvent::kGestureTap, 2003 WebGestureEvent gesture_event(WebInputEvent::kGestureTap,
2004 WebInputEvent::kNoModifiers, 2004 WebInputEvent::kNoModifiers,
2005 WebInputEvent::kTimeStampForTesting); 2005 WebInputEvent::kTimeStampForTesting);
2006 gesture_event.SetFrameScale(1); 2006 gesture_event.SetFrameScale(1);
(...skipping 14 matching lines...) Expand all
2021 FrameTestHelpers::TestWebRemoteFrameClient remote_client; 2021 FrameTestHelpers::TestWebRemoteFrameClient remote_client;
2022 WebView* view = WebView::Create(&view_client, kWebPageVisibilityStateVisible); 2022 WebView* view = WebView::Create(&view_client, kWebPageVisibilityStateVisible);
2023 view->GetSettings()->SetJavaScriptEnabled(true); 2023 view->GetSettings()->SetJavaScriptEnabled(true);
2024 view->SetMainFrame(remote_client.GetFrame()); 2024 view->SetMainFrame(remote_client.GetFrame());
2025 WebRemoteFrame* root = view->MainFrame()->ToWebRemoteFrame(); 2025 WebRemoteFrame* root = view->MainFrame()->ToWebRemoteFrame();
2026 root->SetReplicatedOrigin(SecurityOrigin::CreateUnique()); 2026 root->SetReplicatedOrigin(SecurityOrigin::CreateUnique());
2027 2027
2028 WebFrameOwnerProperties properties; 2028 WebFrameOwnerProperties properties;
2029 properties.margin_width = 11; 2029 properties.margin_width = 11;
2030 properties.margin_height = 22; 2030 properties.margin_height = 22;
2031 WebLocalFrameImpl* local_frame = FrameTestHelpers::CreateLocalChild( 2031 WebLocalFrameBase* local_frame = FrameTestHelpers::CreateLocalChild(
2032 root, "frameName", nullptr, nullptr, nullptr, properties); 2032 root, "frameName", nullptr, nullptr, nullptr, properties);
2033 2033
2034 RegisterMockedHttpURLLoad("frame_owner_properties.html"); 2034 RegisterMockedHttpURLLoad("frame_owner_properties.html");
2035 FrameTestHelpers::LoadFrame(local_frame, 2035 FrameTestHelpers::LoadFrame(local_frame,
2036 base_url_ + "frame_owner_properties.html"); 2036 base_url_ + "frame_owner_properties.html");
2037 2037
2038 // Check if the LocalFrame has seen the marginwidth and marginheight 2038 // Check if the LocalFrame has seen the marginwidth and marginheight
2039 // properties. 2039 // properties.
2040 Document* child_document = local_frame->GetFrame()->GetDocument(); 2040 Document* child_document = local_frame->GetFrame()->GetDocument();
2041 EXPECT_EQ(11, child_document->FirstBodyElement()->GetIntegralAttribute( 2041 EXPECT_EQ(11, child_document->FirstBodyElement()->GetIntegralAttribute(
(...skipping 15 matching lines...) Expand all
2057 WebView* view = WebView::Create(&view_client, kWebPageVisibilityStateVisible); 2057 WebView* view = WebView::Create(&view_client, kWebPageVisibilityStateVisible);
2058 view->GetSettings()->SetJavaScriptEnabled(true); 2058 view->GetSettings()->SetJavaScriptEnabled(true);
2059 view->SetMainFrame(remote_client.GetFrame()); 2059 view->SetMainFrame(remote_client.GetFrame());
2060 WebRemoteFrame* root = view->MainFrame()->ToWebRemoteFrame(); 2060 WebRemoteFrame* root = view->MainFrame()->ToWebRemoteFrame();
2061 root->SetReplicatedOrigin(SecurityOrigin::CreateUnique()); 2061 root->SetReplicatedOrigin(SecurityOrigin::CreateUnique());
2062 2062
2063 WebFrameOwnerProperties properties; 2063 WebFrameOwnerProperties properties;
2064 // Turn off scrolling in the subframe. 2064 // Turn off scrolling in the subframe.
2065 properties.scrolling_mode = 2065 properties.scrolling_mode =
2066 WebFrameOwnerProperties::ScrollingMode::kAlwaysOff; 2066 WebFrameOwnerProperties::ScrollingMode::kAlwaysOff;
2067 WebLocalFrameImpl* local_frame = FrameTestHelpers::CreateLocalChild( 2067 WebLocalFrameBase* local_frame = FrameTestHelpers::CreateLocalChild(
2068 root, "frameName", nullptr, nullptr, nullptr, properties); 2068 root, "frameName", nullptr, nullptr, nullptr, properties);
2069 2069
2070 RegisterMockedHttpURLLoad("frame_owner_properties.html"); 2070 RegisterMockedHttpURLLoad("frame_owner_properties.html");
2071 FrameTestHelpers::LoadFrame(local_frame, 2071 FrameTestHelpers::LoadFrame(local_frame,
2072 base_url_ + "frame_owner_properties.html"); 2072 base_url_ + "frame_owner_properties.html");
2073 2073
2074 Document* child_document = local_frame->GetFrame()->GetDocument(); 2074 Document* child_document = local_frame->GetFrame()->GetDocument();
2075 EXPECT_EQ(0, child_document->FirstBodyElement()->GetIntegralAttribute( 2075 EXPECT_EQ(0, child_document->FirstBodyElement()->GetIntegralAttribute(
2076 HTMLNames::marginwidthAttr)); 2076 HTMLNames::marginwidthAttr));
2077 EXPECT_EQ(0, child_document->FirstBodyElement()->GetIntegralAttribute( 2077 EXPECT_EQ(0, child_document->FirstBodyElement()->GetIntegralAttribute(
2078 HTMLNames::marginheightAttr)); 2078 HTMLNames::marginheightAttr));
2079 2079
2080 FrameView* frame_view = 2080 FrameView* frame_view =
2081 static_cast<WebLocalFrameImpl*>(local_frame)->GetFrameView(); 2081 static_cast<WebLocalFrameBase*>(local_frame)->GetFrameView();
2082 EXPECT_EQ(nullptr, frame_view->HorizontalScrollbar()); 2082 EXPECT_EQ(nullptr, frame_view->HorizontalScrollbar());
2083 EXPECT_EQ(nullptr, frame_view->VerticalScrollbar()); 2083 EXPECT_EQ(nullptr, frame_view->VerticalScrollbar());
2084 2084
2085 view->Close(); 2085 view->Close();
2086 } 2086 }
2087 2087
2088 TEST_P(ParameterizedWebFrameTest, 2088 TEST_P(ParameterizedWebFrameTest,
2089 SetForceZeroLayoutHeightWorksAcrossNavigations) { 2089 SetForceZeroLayoutHeightWorksAcrossNavigations) {
2090 RegisterMockedHttpURLLoad("200-by-300.html"); 2090 RegisterMockedHttpURLLoad("200-by-300.html");
2091 RegisterMockedHttpURLLoad("large-div.html"); 2091 RegisterMockedHttpURLLoad("large-div.html");
(...skipping 2810 matching lines...) Expand 10 before | Expand all | Expand 10 after
4902 4902
4903 // Note that the 'result 19' in the <select> element is not expected to 4903 // Note that the 'result 19' in the <select> element is not expected to
4904 // produce a match. Also, results 00 and 01 are in a different frame that is 4904 // produce a match. Also, results 00 and 01 are in a different frame that is
4905 // not included in this test. 4905 // not included in this test.
4906 const char kFindString[] = "result"; 4906 const char kFindString[] = "result";
4907 const int kFindIdentifier = 12345; 4907 const int kFindIdentifier = 12345;
4908 const int kNumResults = 17; 4908 const int kNumResults = 17;
4909 4909
4910 WebFindOptions options; 4910 WebFindOptions options;
4911 WebString search_text = WebString::FromUTF8(kFindString); 4911 WebString search_text = WebString::FromUTF8(kFindString);
4912 WebLocalFrameImpl* main_frame = web_view_helper.WebView()->MainFrameImpl(); 4912 WebLocalFrameBase* main_frame = web_view_helper.WebView()->MainFrameImpl();
4913 EXPECT_TRUE(main_frame->Find(kFindIdentifier, search_text, options, false)); 4913 EXPECT_TRUE(main_frame->Find(kFindIdentifier, search_text, options, false));
4914 4914
4915 main_frame->EnsureTextFinder().ResetMatchCount(); 4915 main_frame->EnsureTextFinder().ResetMatchCount();
4916 4916
4917 for (WebLocalFrameImpl* frame = main_frame; frame; 4917 for (WebLocalFrameBase* frame = main_frame; frame;
4918 frame = static_cast<WebLocalFrameImpl*>(frame->TraverseNext())) { 4918 frame = static_cast<WebLocalFrameBase*>(frame->TraverseNext())) {
4919 frame->EnsureTextFinder().StartScopingStringMatches(kFindIdentifier, 4919 frame->EnsureTextFinder().StartScopingStringMatches(kFindIdentifier,
4920 search_text, options); 4920 search_text, options);
4921 } 4921 }
4922 4922
4923 RunPendingTasks(); 4923 RunPendingTasks();
4924 EXPECT_TRUE(client.FindResultsAreReady()); 4924 EXPECT_TRUE(client.FindResultsAreReady());
4925 4925
4926 WebVector<WebFloatRect> web_match_rects; 4926 WebVector<WebFloatRect> web_match_rects;
4927 main_frame->FindMatchRects(web_match_rects); 4927 main_frame->FindMatchRects(web_match_rects);
4928 ASSERT_EQ(static_cast<size_t>(kNumResults), web_match_rects.size()); 4928 ASSERT_EQ(static_cast<size_t>(kNumResults), web_match_rects.size());
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
4968 &client); 4968 &client);
4969 web_view_helper.WebView()->Resize(WebSize(640, 480)); 4969 web_view_helper.WebView()->Resize(WebSize(640, 480));
4970 RunPendingTasks(); 4970 RunPendingTasks();
4971 4971
4972 const char* kFindString = "a"; 4972 const char* kFindString = "a";
4973 const int kFindIdentifier = 7777; 4973 const int kFindIdentifier = 7777;
4974 const int kActiveIndex = 1; 4974 const int kActiveIndex = 1;
4975 4975
4976 WebFindOptions options; 4976 WebFindOptions options;
4977 WebString search_text = WebString::FromUTF8(kFindString); 4977 WebString search_text = WebString::FromUTF8(kFindString);
4978 WebLocalFrameImpl* main_frame = web_view_helper.WebView()->MainFrameImpl(); 4978 WebLocalFrameBase* main_frame = web_view_helper.WebView()->MainFrameImpl();
4979 EXPECT_TRUE(main_frame->Find(kFindIdentifier, search_text, options, false)); 4979 EXPECT_TRUE(main_frame->Find(kFindIdentifier, search_text, options, false));
4980 main_frame->EnsureTextFinder().ResetMatchCount(); 4980 main_frame->EnsureTextFinder().ResetMatchCount();
4981 4981
4982 for (WebLocalFrameImpl* frame = main_frame; frame; 4982 for (WebLocalFrameBase* frame = main_frame; frame;
4983 frame = static_cast<WebLocalFrameImpl*>(frame->TraverseNext())) { 4983 frame = static_cast<WebLocalFrameBase*>(frame->TraverseNext())) {
4984 frame->EnsureTextFinder().StartScopingStringMatches(kFindIdentifier, 4984 frame->EnsureTextFinder().StartScopingStringMatches(kFindIdentifier,
4985 search_text, options); 4985 search_text, options);
4986 } 4986 }
4987 4987
4988 RunPendingTasks(); 4988 RunPendingTasks();
4989 EXPECT_TRUE(main_frame->Find(kFindIdentifier, search_text, options, false)); 4989 EXPECT_TRUE(main_frame->Find(kFindIdentifier, search_text, options, false));
4990 main_frame->StopFinding(WebLocalFrame::kStopFindActionClearSelection); 4990 main_frame->StopFinding(WebLocalFrame::kStopFindActionClearSelection);
4991 4991
4992 for (WebLocalFrameImpl* frame = main_frame; frame; 4992 for (WebLocalFrameBase* frame = main_frame; frame;
4993 frame = static_cast<WebLocalFrameImpl*>(frame->TraverseNext())) { 4993 frame = static_cast<WebLocalFrameBase*>(frame->TraverseNext())) {
4994 frame->EnsureTextFinder().StartScopingStringMatches(kFindIdentifier, 4994 frame->EnsureTextFinder().StartScopingStringMatches(kFindIdentifier,
4995 search_text, options); 4995 search_text, options);
4996 } 4996 }
4997 4997
4998 RunPendingTasks(); 4998 RunPendingTasks();
4999 EXPECT_TRUE(client.FindResultsAreReady()); 4999 EXPECT_TRUE(client.FindResultsAreReady());
5000 EXPECT_EQ(kActiveIndex, client.ActiveIndex()); 5000 EXPECT_EQ(kActiveIndex, client.ActiveIndex());
5001 5001
5002 const char* kFindStringNew = "e"; 5002 const char* kFindStringNew = "e";
5003 WebString search_text_new = WebString::FromUTF8(kFindStringNew); 5003 WebString search_text_new = WebString::FromUTF8(kFindStringNew);
5004 5004
5005 EXPECT_TRUE( 5005 EXPECT_TRUE(
5006 main_frame->Find(kFindIdentifier, search_text_new, options, false)); 5006 main_frame->Find(kFindIdentifier, search_text_new, options, false));
5007 main_frame->EnsureTextFinder().ResetMatchCount(); 5007 main_frame->EnsureTextFinder().ResetMatchCount();
5008 5008
5009 for (WebLocalFrameImpl* frame = main_frame; frame; 5009 for (WebLocalFrameBase* frame = main_frame; frame;
5010 frame = static_cast<WebLocalFrameImpl*>(frame->TraverseNext())) { 5010 frame = static_cast<WebLocalFrameBase*>(frame->TraverseNext())) {
5011 frame->EnsureTextFinder().StartScopingStringMatches( 5011 frame->EnsureTextFinder().StartScopingStringMatches(
5012 kFindIdentifier, search_text_new, options); 5012 kFindIdentifier, search_text_new, options);
5013 } 5013 }
5014 5014
5015 RunPendingTasks(); 5015 RunPendingTasks();
5016 EXPECT_TRUE(client.FindResultsAreReady()); 5016 EXPECT_TRUE(client.FindResultsAreReady());
5017 EXPECT_EQ(kActiveIndex, client.ActiveIndex()); 5017 EXPECT_EQ(kActiveIndex, client.ActiveIndex());
5018 } 5018 }
5019 5019
5020 TEST_P(ParameterizedWebFrameTest, FindOnDetachedFrame) { 5020 TEST_P(ParameterizedWebFrameTest, FindOnDetachedFrame) {
5021 RegisterMockedHttpURLLoad("find_in_page.html"); 5021 RegisterMockedHttpURLLoad("find_in_page.html");
5022 RegisterMockedHttpURLLoad("find_in_page_frame.html"); 5022 RegisterMockedHttpURLLoad("find_in_page_frame.html");
5023 5023
5024 FindUpdateWebFrameClient client; 5024 FindUpdateWebFrameClient client;
5025 FrameTestHelpers::WebViewHelper web_view_helper; 5025 FrameTestHelpers::WebViewHelper web_view_helper;
5026 web_view_helper.InitializeAndLoad(base_url_ + "find_in_page.html", true, 5026 web_view_helper.InitializeAndLoad(base_url_ + "find_in_page.html", true,
5027 &client); 5027 &client);
5028 web_view_helper.Resize(WebSize(640, 480)); 5028 web_view_helper.Resize(WebSize(640, 480));
5029 RunPendingTasks(); 5029 RunPendingTasks();
5030 5030
5031 const char kFindString[] = "result"; 5031 const char kFindString[] = "result";
5032 const int kFindIdentifier = 12345; 5032 const int kFindIdentifier = 12345;
5033 5033
5034 WebFindOptions options; 5034 WebFindOptions options;
5035 WebString search_text = WebString::FromUTF8(kFindString); 5035 WebString search_text = WebString::FromUTF8(kFindString);
5036 WebLocalFrameImpl* main_frame = web_view_helper.WebView()->MainFrameImpl(); 5036 WebLocalFrameBase* main_frame = web_view_helper.WebView()->MainFrameImpl();
5037 WebLocalFrameImpl* second_frame = 5037 WebLocalFrameBase* second_frame =
5038 ToWebLocalFrameImpl(main_frame->TraverseNext()); 5038 ToWebLocalFrameBase(main_frame->TraverseNext());
5039 5039
5040 // Detach the frame before finding. 5040 // Detach the frame before finding.
5041 RemoveElementById(main_frame, "frame"); 5041 RemoveElementById(main_frame, "frame");
5042 5042
5043 EXPECT_TRUE(main_frame->Find(kFindIdentifier, search_text, options, false)); 5043 EXPECT_TRUE(main_frame->Find(kFindIdentifier, search_text, options, false));
5044 EXPECT_FALSE( 5044 EXPECT_FALSE(
5045 second_frame->Find(kFindIdentifier, search_text, options, false)); 5045 second_frame->Find(kFindIdentifier, search_text, options, false));
5046 5046
5047 RunPendingTasks(); 5047 RunPendingTasks();
5048 EXPECT_FALSE(client.FindResultsAreReady()); 5048 EXPECT_FALSE(client.FindResultsAreReady());
5049 5049
5050 main_frame->EnsureTextFinder().ResetMatchCount(); 5050 main_frame->EnsureTextFinder().ResetMatchCount();
5051 5051
5052 for (WebLocalFrameImpl* frame = main_frame; frame; 5052 for (WebLocalFrameBase* frame = main_frame; frame;
5053 frame = static_cast<WebLocalFrameImpl*>(frame->TraverseNext())) { 5053 frame = static_cast<WebLocalFrameBase*>(frame->TraverseNext())) {
5054 frame->EnsureTextFinder().StartScopingStringMatches(kFindIdentifier, 5054 frame->EnsureTextFinder().StartScopingStringMatches(kFindIdentifier,
5055 search_text, options); 5055 search_text, options);
5056 } 5056 }
5057 5057
5058 RunPendingTasks(); 5058 RunPendingTasks();
5059 EXPECT_TRUE(client.FindResultsAreReady()); 5059 EXPECT_TRUE(client.FindResultsAreReady());
5060 } 5060 }
5061 5061
5062 TEST_P(ParameterizedWebFrameTest, FindDetachFrameBeforeScopeStrings) { 5062 TEST_P(ParameterizedWebFrameTest, FindDetachFrameBeforeScopeStrings) {
5063 RegisterMockedHttpURLLoad("find_in_page.html"); 5063 RegisterMockedHttpURLLoad("find_in_page.html");
5064 RegisterMockedHttpURLLoad("find_in_page_frame.html"); 5064 RegisterMockedHttpURLLoad("find_in_page_frame.html");
5065 5065
5066 FindUpdateWebFrameClient client; 5066 FindUpdateWebFrameClient client;
5067 FrameTestHelpers::WebViewHelper web_view_helper; 5067 FrameTestHelpers::WebViewHelper web_view_helper;
5068 web_view_helper.InitializeAndLoad(base_url_ + "find_in_page.html", true, 5068 web_view_helper.InitializeAndLoad(base_url_ + "find_in_page.html", true,
5069 &client); 5069 &client);
5070 web_view_helper.Resize(WebSize(640, 480)); 5070 web_view_helper.Resize(WebSize(640, 480));
5071 RunPendingTasks(); 5071 RunPendingTasks();
5072 5072
5073 const char kFindString[] = "result"; 5073 const char kFindString[] = "result";
5074 const int kFindIdentifier = 12345; 5074 const int kFindIdentifier = 12345;
5075 5075
5076 WebFindOptions options; 5076 WebFindOptions options;
5077 WebString search_text = WebString::FromUTF8(kFindString); 5077 WebString search_text = WebString::FromUTF8(kFindString);
5078 WebLocalFrameImpl* main_frame = web_view_helper.WebView()->MainFrameImpl(); 5078 WebLocalFrameBase* main_frame = web_view_helper.WebView()->MainFrameImpl();
5079 5079
5080 for (WebFrame* frame = main_frame; frame; frame = frame->TraverseNext()) 5080 for (WebFrame* frame = main_frame; frame; frame = frame->TraverseNext())
5081 EXPECT_TRUE(frame->ToWebLocalFrame()->Find(kFindIdentifier, search_text, 5081 EXPECT_TRUE(frame->ToWebLocalFrame()->Find(kFindIdentifier, search_text,
5082 options, false)); 5082 options, false));
5083 5083
5084 RunPendingTasks(); 5084 RunPendingTasks();
5085 EXPECT_FALSE(client.FindResultsAreReady()); 5085 EXPECT_FALSE(client.FindResultsAreReady());
5086 5086
5087 // Detach the frame between finding and scoping. 5087 // Detach the frame between finding and scoping.
5088 RemoveElementById(main_frame, "frame"); 5088 RemoveElementById(main_frame, "frame");
5089 5089
5090 main_frame->EnsureTextFinder().ResetMatchCount(); 5090 main_frame->EnsureTextFinder().ResetMatchCount();
5091 5091
5092 for (WebLocalFrameImpl* frame = main_frame; frame; 5092 for (WebLocalFrameBase* frame = main_frame; frame;
5093 frame = static_cast<WebLocalFrameImpl*>(frame->TraverseNext())) { 5093 frame = static_cast<WebLocalFrameBase*>(frame->TraverseNext())) {
5094 frame->EnsureTextFinder().StartScopingStringMatches(kFindIdentifier, 5094 frame->EnsureTextFinder().StartScopingStringMatches(kFindIdentifier,
5095 search_text, options); 5095 search_text, options);
5096 } 5096 }
5097 5097
5098 RunPendingTasks(); 5098 RunPendingTasks();
5099 EXPECT_TRUE(client.FindResultsAreReady()); 5099 EXPECT_TRUE(client.FindResultsAreReady());
5100 } 5100 }
5101 5101
5102 TEST_P(ParameterizedWebFrameTest, FindDetachFrameWhileScopingStrings) { 5102 TEST_P(ParameterizedWebFrameTest, FindDetachFrameWhileScopingStrings) {
5103 RegisterMockedHttpURLLoad("find_in_page.html"); 5103 RegisterMockedHttpURLLoad("find_in_page.html");
5104 RegisterMockedHttpURLLoad("find_in_page_frame.html"); 5104 RegisterMockedHttpURLLoad("find_in_page_frame.html");
5105 5105
5106 FindUpdateWebFrameClient client; 5106 FindUpdateWebFrameClient client;
5107 FrameTestHelpers::WebViewHelper web_view_helper; 5107 FrameTestHelpers::WebViewHelper web_view_helper;
5108 web_view_helper.InitializeAndLoad(base_url_ + "find_in_page.html", true, 5108 web_view_helper.InitializeAndLoad(base_url_ + "find_in_page.html", true,
5109 &client); 5109 &client);
5110 web_view_helper.Resize(WebSize(640, 480)); 5110 web_view_helper.Resize(WebSize(640, 480));
5111 RunPendingTasks(); 5111 RunPendingTasks();
5112 5112
5113 const char kFindString[] = "result"; 5113 const char kFindString[] = "result";
5114 const int kFindIdentifier = 12345; 5114 const int kFindIdentifier = 12345;
5115 5115
5116 WebFindOptions options; 5116 WebFindOptions options;
5117 WebString search_text = WebString::FromUTF8(kFindString); 5117 WebString search_text = WebString::FromUTF8(kFindString);
5118 WebLocalFrameImpl* main_frame = web_view_helper.WebView()->MainFrameImpl(); 5118 WebLocalFrameBase* main_frame = web_view_helper.WebView()->MainFrameImpl();
5119 5119
5120 for (WebFrame* frame = main_frame; frame; frame = frame->TraverseNext()) 5120 for (WebFrame* frame = main_frame; frame; frame = frame->TraverseNext())
5121 EXPECT_TRUE(frame->ToWebLocalFrame()->Find(kFindIdentifier, search_text, 5121 EXPECT_TRUE(frame->ToWebLocalFrame()->Find(kFindIdentifier, search_text,
5122 options, false)); 5122 options, false));
5123 5123
5124 RunPendingTasks(); 5124 RunPendingTasks();
5125 EXPECT_FALSE(client.FindResultsAreReady()); 5125 EXPECT_FALSE(client.FindResultsAreReady());
5126 5126
5127 main_frame->EnsureTextFinder().ResetMatchCount(); 5127 main_frame->EnsureTextFinder().ResetMatchCount();
5128 5128
5129 for (WebLocalFrameImpl* frame = main_frame; frame; 5129 for (WebLocalFrameBase* frame = main_frame; frame;
5130 frame = static_cast<WebLocalFrameImpl*>(frame->TraverseNext())) { 5130 frame = static_cast<WebLocalFrameBase*>(frame->TraverseNext())) {
5131 frame->EnsureTextFinder().StartScopingStringMatches(kFindIdentifier, 5131 frame->EnsureTextFinder().StartScopingStringMatches(kFindIdentifier,
5132 search_text, options); 5132 search_text, options);
5133 } 5133 }
5134 5134
5135 // The first startScopingStringMatches will have reset the state. Detach 5135 // The first startScopingStringMatches will have reset the state. Detach
5136 // before it actually scopes. 5136 // before it actually scopes.
5137 RemoveElementById(main_frame, "frame"); 5137 RemoveElementById(main_frame, "frame");
5138 5138
5139 RunPendingTasks(); 5139 RunPendingTasks();
5140 EXPECT_TRUE(client.FindResultsAreReady()); 5140 EXPECT_TRUE(client.FindResultsAreReady());
5141 } 5141 }
5142 5142
5143 TEST_P(ParameterizedWebFrameTest, ResetMatchCount) { 5143 TEST_P(ParameterizedWebFrameTest, ResetMatchCount) {
5144 RegisterMockedHttpURLLoad("find_in_generated_frame.html"); 5144 RegisterMockedHttpURLLoad("find_in_generated_frame.html");
5145 5145
5146 FindUpdateWebFrameClient client; 5146 FindUpdateWebFrameClient client;
5147 FrameTestHelpers::WebViewHelper web_view_helper; 5147 FrameTestHelpers::WebViewHelper web_view_helper;
5148 web_view_helper.InitializeAndLoad(base_url_ + "find_in_generated_frame.html", 5148 web_view_helper.InitializeAndLoad(base_url_ + "find_in_generated_frame.html",
5149 true, &client); 5149 true, &client);
5150 web_view_helper.Resize(WebSize(640, 480)); 5150 web_view_helper.Resize(WebSize(640, 480));
5151 RunPendingTasks(); 5151 RunPendingTasks();
5152 5152
5153 const char kFindString[] = "result"; 5153 const char kFindString[] = "result";
5154 const int kFindIdentifier = 12345; 5154 const int kFindIdentifier = 12345;
5155 5155
5156 WebFindOptions options; 5156 WebFindOptions options;
5157 WebString search_text = WebString::FromUTF8(kFindString); 5157 WebString search_text = WebString::FromUTF8(kFindString);
5158 WebLocalFrameImpl* main_frame = web_view_helper.WebView()->MainFrameImpl(); 5158 WebLocalFrameBase* main_frame = web_view_helper.WebView()->MainFrameImpl();
5159 5159
5160 // Check that child frame exists. 5160 // Check that child frame exists.
5161 EXPECT_TRUE(!!main_frame->TraverseNext()); 5161 EXPECT_TRUE(!!main_frame->TraverseNext());
5162 5162
5163 for (WebFrame* frame = main_frame; frame; frame = frame->TraverseNext()) 5163 for (WebFrame* frame = main_frame; frame; frame = frame->TraverseNext())
5164 EXPECT_FALSE(frame->ToWebLocalFrame()->Find(kFindIdentifier, search_text, 5164 EXPECT_FALSE(frame->ToWebLocalFrame()->Find(kFindIdentifier, search_text,
5165 options, false)); 5165 options, false));
5166 5166
5167 RunPendingTasks(); 5167 RunPendingTasks();
5168 EXPECT_FALSE(client.FindResultsAreReady()); 5168 EXPECT_FALSE(client.FindResultsAreReady());
5169 5169
5170 main_frame->EnsureTextFinder().ResetMatchCount(); 5170 main_frame->EnsureTextFinder().ResetMatchCount();
5171 } 5171 }
5172 5172
5173 TEST_P(ParameterizedWebFrameTest, SetTickmarks) { 5173 TEST_P(ParameterizedWebFrameTest, SetTickmarks) {
5174 RegisterMockedHttpURLLoad("find.html"); 5174 RegisterMockedHttpURLLoad("find.html");
5175 5175
5176 FindUpdateWebFrameClient client; 5176 FindUpdateWebFrameClient client;
5177 FrameTestHelpers::WebViewHelper web_view_helper; 5177 FrameTestHelpers::WebViewHelper web_view_helper;
5178 web_view_helper.InitializeAndLoad(base_url_ + "find.html", true, &client); 5178 web_view_helper.InitializeAndLoad(base_url_ + "find.html", true, &client);
5179 web_view_helper.Resize(WebSize(640, 480)); 5179 web_view_helper.Resize(WebSize(640, 480));
5180 RunPendingTasks(); 5180 RunPendingTasks();
5181 5181
5182 const char kFindString[] = "foo"; 5182 const char kFindString[] = "foo";
5183 const int kFindIdentifier = 12345; 5183 const int kFindIdentifier = 12345;
5184 5184
5185 WebFindOptions options; 5185 WebFindOptions options;
5186 WebString search_text = WebString::FromUTF8(kFindString); 5186 WebString search_text = WebString::FromUTF8(kFindString);
5187 WebLocalFrameImpl* main_frame = web_view_helper.WebView()->MainFrameImpl(); 5187 WebLocalFrameBase* main_frame = web_view_helper.WebView()->MainFrameImpl();
5188 EXPECT_TRUE(main_frame->Find(kFindIdentifier, search_text, options, false)); 5188 EXPECT_TRUE(main_frame->Find(kFindIdentifier, search_text, options, false));
5189 5189
5190 main_frame->EnsureTextFinder().ResetMatchCount(); 5190 main_frame->EnsureTextFinder().ResetMatchCount();
5191 main_frame->EnsureTextFinder().StartScopingStringMatches( 5191 main_frame->EnsureTextFinder().StartScopingStringMatches(
5192 kFindIdentifier, search_text, options); 5192 kFindIdentifier, search_text, options);
5193 5193
5194 RunPendingTasks(); 5194 RunPendingTasks();
5195 EXPECT_TRUE(client.FindResultsAreReady()); 5195 EXPECT_TRUE(client.FindResultsAreReady());
5196 5196
5197 // Get the tickmarks for the original find request. 5197 // Get the tickmarks for the original find request.
(...skipping 28 matching lines...) Expand all
5226 5226
5227 TEST_P(ParameterizedWebFrameTest, FindInPageJavaScriptUpdatesDOM) { 5227 TEST_P(ParameterizedWebFrameTest, FindInPageJavaScriptUpdatesDOM) {
5228 RegisterMockedHttpURLLoad("find.html"); 5228 RegisterMockedHttpURLLoad("find.html");
5229 5229
5230 FindUpdateWebFrameClient client; 5230 FindUpdateWebFrameClient client;
5231 FrameTestHelpers::WebViewHelper web_view_helper; 5231 FrameTestHelpers::WebViewHelper web_view_helper;
5232 web_view_helper.InitializeAndLoad(base_url_ + "find.html", true, &client); 5232 web_view_helper.InitializeAndLoad(base_url_ + "find.html", true, &client);
5233 web_view_helper.Resize(WebSize(640, 480)); 5233 web_view_helper.Resize(WebSize(640, 480));
5234 RunPendingTasks(); 5234 RunPendingTasks();
5235 5235
5236 WebLocalFrameImpl* frame = web_view_helper.WebView()->MainFrameImpl(); 5236 WebLocalFrameBase* frame = web_view_helper.WebView()->MainFrameImpl();
5237 const int kFindIdentifier = 12345; 5237 const int kFindIdentifier = 12345;
5238 static const char* kFindString = "foo"; 5238 static const char* kFindString = "foo";
5239 WebString search_text = WebString::FromUTF8(kFindString); 5239 WebString search_text = WebString::FromUTF8(kFindString);
5240 WebFindOptions options; 5240 WebFindOptions options;
5241 bool active_now; 5241 bool active_now;
5242 5242
5243 frame->EnsureTextFinder().ResetMatchCount(); 5243 frame->EnsureTextFinder().ResetMatchCount();
5244 frame->EnsureTextFinder().StartScopingStringMatches(kFindIdentifier, 5244 frame->EnsureTextFinder().StartScopingStringMatches(kFindIdentifier,
5245 search_text, options); 5245 search_text, options);
5246 RunPendingTasks(); 5246 RunPendingTasks();
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
5299 // We have 2 occurrences of the pattern in our text. 5299 // We have 2 occurrences of the pattern in our text.
5300 const char* html = 5300 const char* html =
5301 "foo bar foo bar foo abc bar foo bar foo bar foo bar foo bar foo bar foo " 5301 "foo bar foo bar foo abc bar foo bar foo bar foo bar foo bar foo bar foo "
5302 "bar foo bar foo bar foo bar foo bar foo bar foo bar foo bar foo bar foo " 5302 "bar foo bar foo bar foo bar foo bar foo bar foo bar foo bar foo bar foo "
5303 "bar foo bar foo abc bar <div id='new_text'></div>"; 5303 "bar foo bar foo abc bar <div id='new_text'></div>";
5304 5304
5305 FindUpdateWebFrameClient client; 5305 FindUpdateWebFrameClient client;
5306 FrameTestHelpers::WebViewHelper web_view_helper; 5306 FrameTestHelpers::WebViewHelper web_view_helper;
5307 web_view_helper.Initialize(true, &client); 5307 web_view_helper.Initialize(true, &client);
5308 5308
5309 WebLocalFrameImpl* frame = web_view_helper.WebView()->MainFrameImpl(); 5309 WebLocalFrameBase* frame = web_view_helper.WebView()->MainFrameImpl();
5310 FrameTestHelpers::LoadHTMLString(frame, html, 5310 FrameTestHelpers::LoadHTMLString(frame, html,
5311 URLTestHelpers::ToKURL(base_url_)); 5311 URLTestHelpers::ToKURL(base_url_));
5312 web_view_helper.Resize(WebSize(640, 480)); 5312 web_view_helper.Resize(WebSize(640, 480));
5313 web_view_helper.WebView()->SetFocus(true); 5313 web_view_helper.WebView()->SetFocus(true);
5314 RunPendingTasks(); 5314 RunPendingTasks();
5315 5315
5316 const int kFindIdentifier = 12345; 5316 const int kFindIdentifier = 12345;
5317 WebFindOptions options; 5317 WebFindOptions options;
5318 5318
5319 // The first search that will start the scoping process. 5319 // The first search that will start the scoping process.
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
5416 selection_string == "Some offscreen test text for testing"); 5416 selection_string == "Some offscreen test text for testing");
5417 } 5417 }
5418 5418
5419 TEST_P(ParameterizedWebFrameTest, SelectRangeDefaultHandleVisibility) { 5419 TEST_P(ParameterizedWebFrameTest, SelectRangeDefaultHandleVisibility) {
5420 RegisterMockedHttpURLLoad("select_range_basic.html"); 5420 RegisterMockedHttpURLLoad("select_range_basic.html");
5421 5421
5422 FrameTestHelpers::WebViewHelper web_view_helper; 5422 FrameTestHelpers::WebViewHelper web_view_helper;
5423 InitializeTextSelectionWebView(base_url_ + "select_range_basic.html", 5423 InitializeTextSelectionWebView(base_url_ + "select_range_basic.html",
5424 &web_view_helper); 5424 &web_view_helper);
5425 5425
5426 WebLocalFrameImpl* frame = web_view_helper.WebView()->MainFrameImpl(); 5426 WebLocalFrameBase* frame = web_view_helper.WebView()->MainFrameImpl();
5427 frame->SelectRange(WebRange(0, 5)); 5427 frame->SelectRange(WebRange(0, 5));
5428 EXPECT_FALSE(frame->SelectionRange().IsNull()); 5428 EXPECT_FALSE(frame->SelectionRange().IsNull());
5429 5429
5430 EXPECT_FALSE(frame->GetFrame()->Selection().IsHandleVisible()) 5430 EXPECT_FALSE(frame->GetFrame()->Selection().IsHandleVisible())
5431 << "By default selection handles should not be visible"; 5431 << "By default selection handles should not be visible";
5432 } 5432 }
5433 5433
5434 TEST_P(ParameterizedWebFrameTest, SelectRangeHideHandle) { 5434 TEST_P(ParameterizedWebFrameTest, SelectRangeHideHandle) {
5435 RegisterMockedHttpURLLoad("select_range_basic.html"); 5435 RegisterMockedHttpURLLoad("select_range_basic.html");
5436 5436
5437 FrameTestHelpers::WebViewHelper web_view_helper; 5437 FrameTestHelpers::WebViewHelper web_view_helper;
5438 InitializeTextSelectionWebView(base_url_ + "select_range_basic.html", 5438 InitializeTextSelectionWebView(base_url_ + "select_range_basic.html",
5439 &web_view_helper); 5439 &web_view_helper);
5440 5440
5441 WebLocalFrameImpl* frame = web_view_helper.WebView()->MainFrameImpl(); 5441 WebLocalFrameBase* frame = web_view_helper.WebView()->MainFrameImpl();
5442 frame->SelectRange(WebRange(0, 5), WebLocalFrame::kHideSelectionHandle); 5442 frame->SelectRange(WebRange(0, 5), WebLocalFrame::kHideSelectionHandle);
5443 5443
5444 EXPECT_FALSE(frame->GetFrame()->Selection().IsHandleVisible()) 5444 EXPECT_FALSE(frame->GetFrame()->Selection().IsHandleVisible())
5445 << "Selection handle should not be visible with kHideSelectionHandle"; 5445 << "Selection handle should not be visible with kHideSelectionHandle";
5446 } 5446 }
5447 5447
5448 TEST_P(ParameterizedWebFrameTest, SelectRangeShowHandle) { 5448 TEST_P(ParameterizedWebFrameTest, SelectRangeShowHandle) {
5449 RegisterMockedHttpURLLoad("select_range_basic.html"); 5449 RegisterMockedHttpURLLoad("select_range_basic.html");
5450 5450
5451 FrameTestHelpers::WebViewHelper web_view_helper; 5451 FrameTestHelpers::WebViewHelper web_view_helper;
5452 InitializeTextSelectionWebView(base_url_ + "select_range_basic.html", 5452 InitializeTextSelectionWebView(base_url_ + "select_range_basic.html",
5453 &web_view_helper); 5453 &web_view_helper);
5454 5454
5455 WebLocalFrameImpl* frame = web_view_helper.WebView()->MainFrameImpl(); 5455 WebLocalFrameBase* frame = web_view_helper.WebView()->MainFrameImpl();
5456 frame->SelectRange(WebRange(0, 5), WebLocalFrame::kShowSelectionHandle); 5456 frame->SelectRange(WebRange(0, 5), WebLocalFrame::kShowSelectionHandle);
5457 5457
5458 EXPECT_TRUE(frame->GetFrame()->Selection().IsHandleVisible()) 5458 EXPECT_TRUE(frame->GetFrame()->Selection().IsHandleVisible())
5459 << "Selection handle should be visible with kShowSelectionHandle"; 5459 << "Selection handle should be visible with kShowSelectionHandle";
5460 } 5460 }
5461 5461
5462 TEST_P(ParameterizedWebFrameTest, SelectRangePreserveHandleVisibility) { 5462 TEST_P(ParameterizedWebFrameTest, SelectRangePreserveHandleVisibility) {
5463 RegisterMockedHttpURLLoad("select_range_basic.html"); 5463 RegisterMockedHttpURLLoad("select_range_basic.html");
5464 5464
5465 FrameTestHelpers::WebViewHelper web_view_helper; 5465 FrameTestHelpers::WebViewHelper web_view_helper;
5466 InitializeTextSelectionWebView(base_url_ + "select_range_basic.html", 5466 InitializeTextSelectionWebView(base_url_ + "select_range_basic.html",
5467 &web_view_helper); 5467 &web_view_helper);
5468 5468
5469 WebLocalFrameImpl* frame = web_view_helper.WebView()->MainFrameImpl(); 5469 WebLocalFrameBase* frame = web_view_helper.WebView()->MainFrameImpl();
5470 frame->SelectRange(WebRange(0, 5), WebLocalFrame::kHideSelectionHandle); 5470 frame->SelectRange(WebRange(0, 5), WebLocalFrame::kHideSelectionHandle);
5471 frame->SelectRange(WebRange(0, 6), WebLocalFrame::kPreserveHandleVisibility); 5471 frame->SelectRange(WebRange(0, 6), WebLocalFrame::kPreserveHandleVisibility);
5472 5472
5473 EXPECT_FALSE(frame->GetFrame()->Selection().IsHandleVisible()) 5473 EXPECT_FALSE(frame->GetFrame()->Selection().IsHandleVisible())
5474 << "kPreserveHandleVisibility should keep handles invisible"; 5474 << "kPreserveHandleVisibility should keep handles invisible";
5475 5475
5476 frame->SelectRange(WebRange(0, 5), WebLocalFrame::kShowSelectionHandle); 5476 frame->SelectRange(WebRange(0, 5), WebLocalFrame::kShowSelectionHandle);
5477 frame->SelectRange(WebRange(0, 6), WebLocalFrame::kPreserveHandleVisibility); 5477 frame->SelectRange(WebRange(0, 6), WebLocalFrame::kPreserveHandleVisibility);
5478 5478
5479 EXPECT_TRUE(frame->GetFrame()->Selection().IsHandleVisible()) 5479 EXPECT_TRUE(frame->GetFrame()->Selection().IsHandleVisible())
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
5692 frame->ExecuteScript(WebScriptSource("selectElement('editable_1');")); 5692 frame->ExecuteScript(WebScriptSource("selectElement('editable_1');"));
5693 EXPECT_EQ("Editable 1.", SelectionAsString(frame)); 5693 EXPECT_EQ("Editable 1.", SelectionAsString(frame));
5694 frame->SelectRange(TopLeft(ElementBounds(frame, "editable_1")), 5694 frame->SelectRange(TopLeft(ElementBounds(frame, "editable_1")),
5695 BottomRightMinusOne(ElementBounds(frame, "footer_1"))); 5695 BottomRightMinusOne(ElementBounds(frame, "footer_1")));
5696 // positionForPoint returns the wrong values for contenteditable spans. See 5696 // positionForPoint returns the wrong values for contenteditable spans. See
5697 // http://crbug.com/238334. 5697 // http://crbug.com/238334.
5698 // EXPECT_EQ("Editable 1. Editable 2. ]", selectionAsString(frame)); 5698 // EXPECT_EQ("Editable 1. Editable 2. ]", selectionAsString(frame));
5699 } 5699 }
5700 5700
5701 TEST_P(ParameterizedWebFrameTest, MoveRangeSelectionExtent) { 5701 TEST_P(ParameterizedWebFrameTest, MoveRangeSelectionExtent) {
5702 WebLocalFrameImpl* frame; 5702 WebLocalFrameBase* frame;
5703 WebRect start_web_rect; 5703 WebRect start_web_rect;
5704 WebRect end_web_rect; 5704 WebRect end_web_rect;
5705 5705
5706 RegisterMockedHttpURLLoad("move_range_selection_extent.html"); 5706 RegisterMockedHttpURLLoad("move_range_selection_extent.html");
5707 5707
5708 FrameTestHelpers::WebViewHelper web_view_helper; 5708 FrameTestHelpers::WebViewHelper web_view_helper;
5709 InitializeTextSelectionWebView(base_url_ + "move_range_selection_extent.html", 5709 InitializeTextSelectionWebView(base_url_ + "move_range_selection_extent.html",
5710 &web_view_helper); 5710 &web_view_helper);
5711 frame = web_view_helper.WebView()->MainFrameImpl(); 5711 frame = web_view_helper.WebView()->MainFrameImpl();
5712 EXPECT_EQ("This text is initially selected.", SelectionAsString(frame)); 5712 EXPECT_EQ("This text is initially selected.", SelectionAsString(frame));
(...skipping 16 matching lines...) Expand all
5729 5729
5730 frame->MoveRangeSelectionExtent(WebPoint(0, 0)); 5730 frame->MoveRangeSelectionExtent(WebPoint(0, 0));
5731 EXPECT_EQ("16-char header. This text is initially selected.", 5731 EXPECT_EQ("16-char header. This text is initially selected.",
5732 SelectionAsString(frame)); 5732 SelectionAsString(frame));
5733 5733
5734 frame->ExecuteCommand(WebString::FromUTF8("Unselect")); 5734 frame->ExecuteCommand(WebString::FromUTF8("Unselect"));
5735 EXPECT_EQ("", SelectionAsString(frame)); 5735 EXPECT_EQ("", SelectionAsString(frame));
5736 } 5736 }
5737 5737
5738 TEST_P(ParameterizedWebFrameTest, MoveRangeSelectionExtentCannotCollapse) { 5738 TEST_P(ParameterizedWebFrameTest, MoveRangeSelectionExtentCannotCollapse) {
5739 WebLocalFrameImpl* frame; 5739 WebLocalFrameBase* frame;
5740 WebRect start_web_rect; 5740 WebRect start_web_rect;
5741 WebRect end_web_rect; 5741 WebRect end_web_rect;
5742 5742
5743 RegisterMockedHttpURLLoad("move_range_selection_extent.html"); 5743 RegisterMockedHttpURLLoad("move_range_selection_extent.html");
5744 5744
5745 FrameTestHelpers::WebViewHelper web_view_helper; 5745 FrameTestHelpers::WebViewHelper web_view_helper;
5746 InitializeTextSelectionWebView(base_url_ + "move_range_selection_extent.html", 5746 InitializeTextSelectionWebView(base_url_ + "move_range_selection_extent.html",
5747 &web_view_helper); 5747 &web_view_helper);
5748 frame = web_view_helper.WebView()->MainFrameImpl(); 5748 frame = web_view_helper.WebView()->MainFrameImpl();
5749 EXPECT_EQ("This text is initially selected.", SelectionAsString(frame)); 5749 EXPECT_EQ("This text is initially selected.", SelectionAsString(frame));
5750 web_view_helper.WebView()->SelectionBounds(start_web_rect, end_web_rect); 5750 web_view_helper.WebView()->SelectionBounds(start_web_rect, end_web_rect);
5751 5751
5752 frame->MoveRangeSelectionExtent(BottomRightMinusOne(start_web_rect)); 5752 frame->MoveRangeSelectionExtent(BottomRightMinusOne(start_web_rect));
5753 EXPECT_EQ("This text is initially selected.", SelectionAsString(frame)); 5753 EXPECT_EQ("This text is initially selected.", SelectionAsString(frame));
5754 5754
5755 // Reset with swapped base and extent. 5755 // Reset with swapped base and extent.
5756 frame->SelectRange(TopLeft(end_web_rect), 5756 frame->SelectRange(TopLeft(end_web_rect),
5757 BottomRightMinusOne(start_web_rect)); 5757 BottomRightMinusOne(start_web_rect));
5758 EXPECT_EQ("This text is initially selected.", SelectionAsString(frame)); 5758 EXPECT_EQ("This text is initially selected.", SelectionAsString(frame));
5759 5759
5760 frame->MoveRangeSelectionExtent(BottomRightMinusOne(end_web_rect)); 5760 frame->MoveRangeSelectionExtent(BottomRightMinusOne(end_web_rect));
5761 EXPECT_EQ("This text is initially selected.", SelectionAsString(frame)); 5761 EXPECT_EQ("This text is initially selected.", SelectionAsString(frame));
5762 } 5762 }
5763 5763
5764 TEST_P(ParameterizedWebFrameTest, MoveRangeSelectionExtentScollsInputField) { 5764 TEST_P(ParameterizedWebFrameTest, MoveRangeSelectionExtentScollsInputField) {
5765 WebLocalFrameImpl* frame; 5765 WebLocalFrameBase* frame;
5766 WebRect start_web_rect; 5766 WebRect start_web_rect;
5767 WebRect end_web_rect; 5767 WebRect end_web_rect;
5768 5768
5769 RegisterMockedHttpURLLoad("move_range_selection_extent_input_field.html"); 5769 RegisterMockedHttpURLLoad("move_range_selection_extent_input_field.html");
5770 5770
5771 FrameTestHelpers::WebViewHelper web_view_helper; 5771 FrameTestHelpers::WebViewHelper web_view_helper;
5772 InitializeTextSelectionWebView( 5772 InitializeTextSelectionWebView(
5773 base_url_ + "move_range_selection_extent_input_field.html", 5773 base_url_ + "move_range_selection_extent_input_field.html",
5774 &web_view_helper); 5774 &web_view_helper);
5775 frame = web_view_helper.WebView()->MainFrameImpl(); 5775 frame = web_view_helper.WebView()->MainFrameImpl();
(...skipping 23 matching lines...) Expand all
5799 .ComputeOffsetInContainerNode(); 5799 .ComputeOffsetInContainerNode();
5800 } 5800 }
5801 5801
5802 // positionForPoint returns the wrong values for contenteditable spans. See 5802 // positionForPoint returns the wrong values for contenteditable spans. See
5803 // http://crbug.com/238334. 5803 // http://crbug.com/238334.
5804 TEST_P(ParameterizedWebFrameTest, DISABLED_PositionForPointTest) { 5804 TEST_P(ParameterizedWebFrameTest, DISABLED_PositionForPointTest) {
5805 RegisterMockedHttpURLLoad("select_range_span_editable.html"); 5805 RegisterMockedHttpURLLoad("select_range_span_editable.html");
5806 FrameTestHelpers::WebViewHelper web_view_helper; 5806 FrameTestHelpers::WebViewHelper web_view_helper;
5807 InitializeTextSelectionWebView(base_url_ + "select_range_span_editable.html", 5807 InitializeTextSelectionWebView(base_url_ + "select_range_span_editable.html",
5808 &web_view_helper); 5808 &web_view_helper);
5809 WebLocalFrameImpl* main_frame = web_view_helper.WebView()->MainFrameImpl(); 5809 WebLocalFrameBase* main_frame = web_view_helper.WebView()->MainFrameImpl();
5810 LayoutObject* layout_object = 5810 LayoutObject* layout_object =
5811 main_frame->GetFrame() 5811 main_frame->GetFrame()
5812 ->Selection() 5812 ->Selection()
5813 .ComputeVisibleSelectionInDOMTreeDeprecated() 5813 .ComputeVisibleSelectionInDOMTreeDeprecated()
5814 .RootEditableElement() 5814 .RootEditableElement()
5815 ->GetLayoutObject(); 5815 ->GetLayoutObject();
5816 EXPECT_EQ(0, ComputeOffset(layout_object, -1, -1)); 5816 EXPECT_EQ(0, ComputeOffset(layout_object, -1, -1));
5817 EXPECT_EQ(64, ComputeOffset(layout_object, 1000, 1000)); 5817 EXPECT_EQ(64, ComputeOffset(layout_object, 1000, 1000));
5818 5818
5819 RegisterMockedHttpURLLoad("select_range_div_editable.html"); 5819 RegisterMockedHttpURLLoad("select_range_div_editable.html");
(...skipping 10 matching lines...) Expand all
5830 } 5830 }
5831 5831
5832 #if !OS(MACOSX) && !OS(LINUX) 5832 #if !OS(MACOSX) && !OS(LINUX)
5833 TEST_P(ParameterizedWebFrameTest, 5833 TEST_P(ParameterizedWebFrameTest,
5834 SelectRangeStaysHorizontallyAlignedWhenMoved) { 5834 SelectRangeStaysHorizontallyAlignedWhenMoved) {
5835 RegisterMockedHttpURLLoad("move_caret.html"); 5835 RegisterMockedHttpURLLoad("move_caret.html");
5836 5836
5837 FrameTestHelpers::WebViewHelper web_view_helper; 5837 FrameTestHelpers::WebViewHelper web_view_helper;
5838 InitializeTextSelectionWebView(base_url_ + "move_caret.html", 5838 InitializeTextSelectionWebView(base_url_ + "move_caret.html",
5839 &web_view_helper); 5839 &web_view_helper);
5840 WebLocalFrameImpl* frame = web_view_helper.WebView()->MainFrameImpl(); 5840 WebLocalFrameBase* frame = web_view_helper.WebView()->MainFrameImpl();
5841 5841
5842 WebRect initial_start_rect; 5842 WebRect initial_start_rect;
5843 WebRect initial_end_rect; 5843 WebRect initial_end_rect;
5844 WebRect start_rect; 5844 WebRect start_rect;
5845 WebRect end_rect; 5845 WebRect end_rect;
5846 5846
5847 frame->ExecuteScript(WebScriptSource("selectRange();")); 5847 frame->ExecuteScript(WebScriptSource("selectRange();"));
5848 web_view_helper.WebView()->SelectionBounds(initial_start_rect, 5848 web_view_helper.WebView()->SelectionBounds(initial_start_rect,
5849 initial_end_rect); 5849 initial_end_rect);
5850 WebPoint moved_start(TopLeft(initial_start_rect)); 5850 WebPoint moved_start(TopLeft(initial_start_rect));
(...skipping 19 matching lines...) Expand all
5870 EXPECT_EQ(end_rect, initial_end_rect); 5870 EXPECT_EQ(end_rect, initial_end_rect);
5871 5871
5872 moved_end.y -= 80; 5872 moved_end.y -= 80;
5873 frame->SelectRange(TopLeft(initial_start_rect), moved_end); 5873 frame->SelectRange(TopLeft(initial_start_rect), moved_end);
5874 web_view_helper.WebView()->SelectionBounds(start_rect, end_rect); 5874 web_view_helper.WebView()->SelectionBounds(start_rect, end_rect);
5875 EXPECT_EQ(start_rect, initial_start_rect); 5875 EXPECT_EQ(start_rect, initial_start_rect);
5876 EXPECT_EQ(end_rect, initial_end_rect); 5876 EXPECT_EQ(end_rect, initial_end_rect);
5877 } 5877 }
5878 5878
5879 TEST_P(ParameterizedWebFrameTest, MoveCaretStaysHorizontallyAlignedWhenMoved) { 5879 TEST_P(ParameterizedWebFrameTest, MoveCaretStaysHorizontallyAlignedWhenMoved) {
5880 WebLocalFrameImpl* frame; 5880 WebLocalFrameBase* frame;
5881 RegisterMockedHttpURLLoad("move_caret.html"); 5881 RegisterMockedHttpURLLoad("move_caret.html");
5882 5882
5883 FrameTestHelpers::WebViewHelper web_view_helper; 5883 FrameTestHelpers::WebViewHelper web_view_helper;
5884 InitializeTextSelectionWebView(base_url_ + "move_caret.html", 5884 InitializeTextSelectionWebView(base_url_ + "move_caret.html",
5885 &web_view_helper); 5885 &web_view_helper);
5886 frame = (WebLocalFrameImpl*)web_view_helper.WebView()->MainFrame(); 5886 frame = (WebLocalFrameBase*)web_view_helper.WebView()->MainFrame();
5887 5887
5888 WebRect initial_start_rect; 5888 WebRect initial_start_rect;
5889 WebRect initial_end_rect; 5889 WebRect initial_end_rect;
5890 WebRect start_rect; 5890 WebRect start_rect;
5891 WebRect end_rect; 5891 WebRect end_rect;
5892 5892
5893 frame->ExecuteScript(WebScriptSource("selectCaret();")); 5893 frame->ExecuteScript(WebScriptSource("selectCaret();"));
5894 web_view_helper.WebView()->SelectionBounds(initial_start_rect, 5894 web_view_helper.WebView()->SelectionBounds(initial_start_rect,
5895 initial_end_rect); 5895 initial_end_rect);
5896 WebPoint move_to(TopLeft(initial_start_rect)); 5896 WebPoint move_to(TopLeft(initial_start_rect));
(...skipping 705 matching lines...) Expand 10 before | Expand all | Expand 10 after
6602 6602
6603 private: 6603 private:
6604 int number_of_times_checked_; 6604 int number_of_times_checked_;
6605 }; 6605 };
6606 6606
6607 TEST_P(ParameterizedWebFrameTest, ReplaceMisspelledRange) { 6607 TEST_P(ParameterizedWebFrameTest, ReplaceMisspelledRange) {
6608 RegisterMockedHttpURLLoad("spell.html"); 6608 RegisterMockedHttpURLLoad("spell.html");
6609 FrameTestHelpers::WebViewHelper web_view_helper; 6609 FrameTestHelpers::WebViewHelper web_view_helper;
6610 InitializeTextSelectionWebView(base_url_ + "spell.html", &web_view_helper); 6610 InitializeTextSelectionWebView(base_url_ + "spell.html", &web_view_helper);
6611 6611
6612 WebLocalFrameImpl* frame = web_view_helper.WebView()->MainFrameImpl(); 6612 WebLocalFrameBase* frame = web_view_helper.WebView()->MainFrameImpl();
6613 TextCheckClient textcheck; 6613 TextCheckClient textcheck;
6614 frame->SetTextCheckClient(&textcheck); 6614 frame->SetTextCheckClient(&textcheck);
6615 6615
6616 Document* document = frame->GetFrame()->GetDocument(); 6616 Document* document = frame->GetFrame()->GetDocument();
6617 Element* element = document->getElementById("data"); 6617 Element* element = document->getElementById("data");
6618 6618
6619 web_view_helper.WebView()->GetSettings()->SetEditingBehavior( 6619 web_view_helper.WebView()->GetSettings()->SetEditingBehavior(
6620 WebSettings::kEditingBehaviorWin); 6620 WebSettings::kEditingBehaviorWin);
6621 6621
6622 element->focus(); 6622 element->focus();
(...skipping 26 matching lines...) Expand all
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 } 6652 }
6653 6653
6654 TEST_P(ParameterizedWebFrameTest, RemoveSpellingMarkers) { 6654 TEST_P(ParameterizedWebFrameTest, RemoveSpellingMarkers) {
6655 RegisterMockedHttpURLLoad("spell.html"); 6655 RegisterMockedHttpURLLoad("spell.html");
6656 FrameTestHelpers::WebViewHelper web_view_helper; 6656 FrameTestHelpers::WebViewHelper web_view_helper;
6657 InitializeTextSelectionWebView(base_url_ + "spell.html", &web_view_helper); 6657 InitializeTextSelectionWebView(base_url_ + "spell.html", &web_view_helper);
6658 6658
6659 WebLocalFrameImpl* frame = web_view_helper.WebView()->MainFrameImpl(); 6659 WebLocalFrameBase* frame = web_view_helper.WebView()->MainFrameImpl();
6660 TextCheckClient textcheck; 6660 TextCheckClient textcheck;
6661 frame->SetTextCheckClient(&textcheck); 6661 frame->SetTextCheckClient(&textcheck);
6662 6662
6663 Document* document = frame->GetFrame()->GetDocument(); 6663 Document* document = frame->GetFrame()->GetDocument();
6664 Element* element = document->getElementById("data"); 6664 Element* element = document->getElementById("data");
6665 6665
6666 web_view_helper.WebView()->GetSettings()->SetEditingBehavior( 6666 web_view_helper.WebView()->GetSettings()->SetEditingBehavior(
6667 WebSettings::kEditingBehaviorWin); 6667 WebSettings::kEditingBehaviorWin);
6668 6668
6669 element->focus(); 6669 element->focus();
(...skipping 30 matching lines...) Expand all
6700 for (size_t i = 0; i < document_markers.size(); ++i) 6700 for (size_t i = 0; i < document_markers.size(); ++i)
6701 result.push_back(document_markers[i]->StartOffset()); 6701 result.push_back(document_markers[i]->StartOffset());
6702 offsets->Assign(result); 6702 offsets->Assign(result);
6703 } 6703 }
6704 6704
6705 TEST_P(ParameterizedWebFrameTest, RemoveSpellingMarkersUnderWords) { 6705 TEST_P(ParameterizedWebFrameTest, RemoveSpellingMarkersUnderWords) {
6706 RegisterMockedHttpURLLoad("spell.html"); 6706 RegisterMockedHttpURLLoad("spell.html");
6707 FrameTestHelpers::WebViewHelper web_view_helper; 6707 FrameTestHelpers::WebViewHelper web_view_helper;
6708 InitializeTextSelectionWebView(base_url_ + "spell.html", &web_view_helper); 6708 InitializeTextSelectionWebView(base_url_ + "spell.html", &web_view_helper);
6709 6709
6710 WebLocalFrameImpl* web_frame = web_view_helper.WebView()->MainFrameImpl(); 6710 WebLocalFrameBase* web_frame = web_view_helper.WebView()->MainFrameImpl();
6711 TextCheckClient textcheck; 6711 TextCheckClient textcheck;
6712 web_frame->SetTextCheckClient(&textcheck); 6712 web_frame->SetTextCheckClient(&textcheck);
6713 6713
6714 LocalFrame* frame = web_frame->GetFrame(); 6714 LocalFrame* frame = web_frame->GetFrame();
6715 Document* document = frame->GetDocument(); 6715 Document* document = frame->GetDocument();
6716 Element* element = document->getElementById("data"); 6716 Element* element = document->getElementById("data");
6717 6717
6718 web_view_helper.WebView()->GetSettings()->SetEditingBehavior( 6718 web_view_helper.WebView()->GetSettings()->SetEditingBehavior(
6719 WebSettings::kEditingBehaviorWin); 6719 WebSettings::kEditingBehaviorWin);
6720 6720
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
6780 } 6780 }
6781 6781
6782 WebTextCheckingCompletion* completion_; 6782 WebTextCheckingCompletion* completion_;
6783 }; 6783 };
6784 6784
6785 TEST_P(ParameterizedWebFrameTest, SlowSpellcheckMarkerPosition) { 6785 TEST_P(ParameterizedWebFrameTest, SlowSpellcheckMarkerPosition) {
6786 RegisterMockedHttpURLLoad("spell.html"); 6786 RegisterMockedHttpURLLoad("spell.html");
6787 FrameTestHelpers::WebViewHelper web_view_helper; 6787 FrameTestHelpers::WebViewHelper web_view_helper;
6788 InitializeTextSelectionWebView(base_url_ + "spell.html", &web_view_helper); 6788 InitializeTextSelectionWebView(base_url_ + "spell.html", &web_view_helper);
6789 6789
6790 WebLocalFrameImpl* frame = web_view_helper.WebView()->MainFrameImpl(); 6790 WebLocalFrameBase* frame = web_view_helper.WebView()->MainFrameImpl();
6791 StubbornTextCheckClient textcheck; 6791 StubbornTextCheckClient textcheck;
6792 frame->SetTextCheckClient(&textcheck); 6792 frame->SetTextCheckClient(&textcheck);
6793 6793
6794 Document* document = frame->GetFrame()->GetDocument(); 6794 Document* document = frame->GetFrame()->GetDocument();
6795 Element* element = document->getElementById("data"); 6795 Element* element = document->getElementById("data");
6796 6796
6797 web_view_helper.WebView()->GetSettings()->SetEditingBehavior( 6797 web_view_helper.WebView()->GetSettings()->SetEditingBehavior(
6798 WebSettings::kEditingBehaviorWin); 6798 WebSettings::kEditingBehaviorWin);
6799 6799
6800 element->focus(); 6800 element->focus();
(...skipping 21 matching lines...) Expand all
6822 // write-after-free when there's no spellcheck client set. 6822 // write-after-free when there's no spellcheck client set.
6823 TEST_P(ParameterizedWebFrameTest, CancelSpellingRequestCrash) { 6823 TEST_P(ParameterizedWebFrameTest, CancelSpellingRequestCrash) {
6824 // The relevant code paths are obsolete with idle time spell checker. 6824 // The relevant code paths are obsolete with idle time spell checker.
6825 if (RuntimeEnabledFeatures::idleTimeSpellCheckingEnabled()) 6825 if (RuntimeEnabledFeatures::idleTimeSpellCheckingEnabled())
6826 return; 6826 return;
6827 6827
6828 RegisterMockedHttpURLLoad("spell.html"); 6828 RegisterMockedHttpURLLoad("spell.html");
6829 FrameTestHelpers::WebViewHelper web_view_helper; 6829 FrameTestHelpers::WebViewHelper web_view_helper;
6830 web_view_helper.InitializeAndLoad(base_url_ + "spell.html"); 6830 web_view_helper.InitializeAndLoad(base_url_ + "spell.html");
6831 6831
6832 WebLocalFrameImpl* frame = web_view_helper.WebView()->MainFrameImpl(); 6832 WebLocalFrameBase* frame = web_view_helper.WebView()->MainFrameImpl();
6833 frame->SetTextCheckClient(0); 6833 frame->SetTextCheckClient(0);
6834 6834
6835 Document* document = frame->GetFrame()->GetDocument(); 6835 Document* document = frame->GetFrame()->GetDocument();
6836 Element* element = document->getElementById("data"); 6836 Element* element = document->getElementById("data");
6837 6837
6838 web_view_helper.WebView()->GetSettings()->SetEditingBehavior( 6838 web_view_helper.WebView()->GetSettings()->SetEditingBehavior(
6839 WebSettings::kEditingBehaviorWin); 6839 WebSettings::kEditingBehaviorWin);
6840 6840
6841 element->focus(); 6841 element->focus();
6842 frame->GetFrame()->GetEditor().ReplaceSelectionWithText( 6842 frame->GetFrame()->GetEditor().ReplaceSelectionWithText(
6843 "A", false, false, InputEvent::InputType::kInsertReplacementText); 6843 "A", false, false, InputEvent::InputType::kInsertReplacementText);
6844 frame->GetFrame()->GetSpellChecker().CancelCheck(); 6844 frame->GetFrame()->GetSpellChecker().CancelCheck();
6845 } 6845 }
6846 6846
6847 TEST_P(ParameterizedWebFrameTest, SpellcheckResultErasesMarkers) { 6847 TEST_P(ParameterizedWebFrameTest, SpellcheckResultErasesMarkers) {
6848 RegisterMockedHttpURLLoad("spell.html"); 6848 RegisterMockedHttpURLLoad("spell.html");
6849 FrameTestHelpers::WebViewHelper web_view_helper; 6849 FrameTestHelpers::WebViewHelper web_view_helper;
6850 InitializeTextSelectionWebView(base_url_ + "spell.html", &web_view_helper); 6850 InitializeTextSelectionWebView(base_url_ + "spell.html", &web_view_helper);
6851 6851
6852 WebLocalFrameImpl* frame = web_view_helper.WebView()->MainFrameImpl(); 6852 WebLocalFrameBase* frame = web_view_helper.WebView()->MainFrameImpl();
6853 StubbornTextCheckClient textcheck; 6853 StubbornTextCheckClient textcheck;
6854 frame->SetTextCheckClient(&textcheck); 6854 frame->SetTextCheckClient(&textcheck);
6855 6855
6856 Document* document = frame->GetFrame()->GetDocument(); 6856 Document* document = frame->GetFrame()->GetDocument();
6857 Element* element = document->getElementById("data"); 6857 Element* element = document->getElementById("data");
6858 6858
6859 web_view_helper.WebView()->GetSettings()->SetEditingBehavior( 6859 web_view_helper.WebView()->GetSettings()->SetEditingBehavior(
6860 WebSettings::kEditingBehaviorWin); 6860 WebSettings::kEditingBehaviorWin);
6861 6861
6862 element->focus(); 6862 element->focus();
(...skipping 19 matching lines...) Expand all
6882 6882
6883 textcheck.KickNoResults(); 6883 textcheck.KickNoResults();
6884 EXPECT_EQ(0U, document->Markers().Markers().size()); 6884 EXPECT_EQ(0U, document->Markers().Markers().size());
6885 } 6885 }
6886 6886
6887 TEST_P(ParameterizedWebFrameTest, SpellcheckResultsSavedInDocument) { 6887 TEST_P(ParameterizedWebFrameTest, SpellcheckResultsSavedInDocument) {
6888 RegisterMockedHttpURLLoad("spell.html"); 6888 RegisterMockedHttpURLLoad("spell.html");
6889 FrameTestHelpers::WebViewHelper web_view_helper; 6889 FrameTestHelpers::WebViewHelper web_view_helper;
6890 InitializeTextSelectionWebView(base_url_ + "spell.html", &web_view_helper); 6890 InitializeTextSelectionWebView(base_url_ + "spell.html", &web_view_helper);
6891 6891
6892 WebLocalFrameImpl* frame = web_view_helper.WebView()->MainFrameImpl(); 6892 WebLocalFrameBase* frame = web_view_helper.WebView()->MainFrameImpl();
6893 StubbornTextCheckClient textcheck; 6893 StubbornTextCheckClient textcheck;
6894 frame->SetTextCheckClient(&textcheck); 6894 frame->SetTextCheckClient(&textcheck);
6895 6895
6896 Document* document = frame->GetFrame()->GetDocument(); 6896 Document* document = frame->GetFrame()->GetDocument();
6897 Element* element = document->getElementById("data"); 6897 Element* element = document->getElementById("data");
6898 6898
6899 web_view_helper.WebView()->GetSettings()->SetEditingBehavior( 6899 web_view_helper.WebView()->GetSettings()->SetEditingBehavior(
6900 WebSettings::kEditingBehaviorWin); 6900 WebSettings::kEditingBehaviorWin);
6901 6901
6902 element->focus(); 6902 element->focus();
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
7106 public: 7106 public:
7107 TestScrolledFrameClient() { Reset(); } 7107 TestScrolledFrameClient() { Reset(); }
7108 void Reset() { did_scroll_frame_ = false; } 7108 void Reset() { did_scroll_frame_ = false; }
7109 bool WasFrameScrolled() const { return did_scroll_frame_; } 7109 bool WasFrameScrolled() const { return did_scroll_frame_; }
7110 7110
7111 // WebFrameClient: 7111 // WebFrameClient:
7112 void DidChangeScrollOffset() override { 7112 void DidChangeScrollOffset() override {
7113 if (Frame()->Parent()) 7113 if (Frame()->Parent())
7114 return; 7114 return;
7115 EXPECT_FALSE(did_scroll_frame_); 7115 EXPECT_FALSE(did_scroll_frame_);
7116 FrameView* view = ToWebLocalFrameImpl(Frame())->GetFrameView(); 7116 FrameView* view = ToWebLocalFrameBase(Frame())->GetFrameView();
7117 // FrameView can be scrolled in FrameView::setFixedVisibleContentRect which 7117 // FrameView can be scrolled in FrameView::setFixedVisibleContentRect which
7118 // is called from LocalFrame::createView (before the frame is associated 7118 // is called from LocalFrame::createView (before the frame is associated
7119 // with the the view). 7119 // with the the view).
7120 if (view) 7120 if (view)
7121 did_scroll_frame_ = true; 7121 did_scroll_frame_ = true;
7122 } 7122 }
7123 7123
7124 private: 7124 private:
7125 bool did_scroll_frame_; 7125 bool did_scroll_frame_;
7126 }; 7126 };
7127 7127
7128 TEST_F(WebFrameTest, CompositorScrollIsUserScrollLongPage) { 7128 TEST_F(WebFrameTest, CompositorScrollIsUserScrollLongPage) {
7129 RegisterMockedHttpURLLoad("long_scroll.html"); 7129 RegisterMockedHttpURLLoad("long_scroll.html");
7130 TestScrolledFrameClient client; 7130 TestScrolledFrameClient client;
7131 7131
7132 // Make sure we initialize to minimum scale, even if the window size 7132 // Make sure we initialize to minimum scale, even if the window size
7133 // only becomes available after the load begins. 7133 // only becomes available after the load begins.
7134 FrameTestHelpers::WebViewHelper web_view_helper; 7134 FrameTestHelpers::WebViewHelper web_view_helper;
7135 web_view_helper.InitializeAndLoad(base_url_ + "long_scroll.html", true, 7135 web_view_helper.InitializeAndLoad(base_url_ + "long_scroll.html", true,
7136 &client); 7136 &client);
7137 web_view_helper.Resize(WebSize(1000, 1000)); 7137 web_view_helper.Resize(WebSize(1000, 1000));
7138 7138
7139 WebLocalFrameImpl* frame_impl = web_view_helper.WebView()->MainFrameImpl(); 7139 WebLocalFrameBase* frame_impl = web_view_helper.WebView()->MainFrameImpl();
7140 DocumentLoader::InitialScrollState& initial_scroll_state = 7140 DocumentLoader::InitialScrollState& initial_scroll_state =
7141 frame_impl->GetFrame() 7141 frame_impl->GetFrame()
7142 ->Loader() 7142 ->Loader()
7143 .GetDocumentLoader() 7143 .GetDocumentLoader()
7144 ->GetInitialScrollState(); 7144 ->GetInitialScrollState();
7145 7145
7146 EXPECT_FALSE(client.WasFrameScrolled()); 7146 EXPECT_FALSE(client.WasFrameScrolled());
7147 EXPECT_FALSE(initial_scroll_state.was_scrolled_by_user); 7147 EXPECT_FALSE(initial_scroll_state.was_scrolled_by_user);
7148 7148
7149 auto* scrollable_area = 7149 auto* scrollable_area =
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
7504 RegisterMockedHttpURLLoad("iframe_reload.html"); 7504 RegisterMockedHttpURLLoad("iframe_reload.html");
7505 RegisterMockedHttpURLLoad("visible_iframe.html"); 7505 RegisterMockedHttpURLLoad("visible_iframe.html");
7506 TestCachePolicyWebFrameClient main_client(0); 7506 TestCachePolicyWebFrameClient main_client(0);
7507 TestCachePolicyWebFrameClient child_client(&main_client); 7507 TestCachePolicyWebFrameClient child_client(&main_client);
7508 main_client.SetChildWebFrameClient(&child_client); 7508 main_client.SetChildWebFrameClient(&child_client);
7509 7509
7510 FrameTestHelpers::WebViewHelper web_view_helper; 7510 FrameTestHelpers::WebViewHelper web_view_helper;
7511 web_view_helper.InitializeAndLoad(base_url_ + "iframe_reload.html", true, 7511 web_view_helper.InitializeAndLoad(base_url_ + "iframe_reload.html", true,
7512 &main_client); 7512 &main_client);
7513 7513
7514 WebLocalFrameImpl* main_frame = web_view_helper.WebView()->MainFrameImpl(); 7514 WebLocalFrameBase* main_frame = web_view_helper.WebView()->MainFrameImpl();
7515 WebLocalFrameImpl* child_frame = 7515 WebLocalFrameBase* child_frame =
7516 ToWebLocalFrameImpl(main_frame->FirstChild()); 7516 ToWebLocalFrameBase(main_frame->FirstChild());
7517 ASSERT_EQ(child_frame->Client(), &child_client); 7517 ASSERT_EQ(child_frame->Client(), &child_client);
7518 EXPECT_EQ(main_client.ChildFrameCreationCount(), 1); 7518 EXPECT_EQ(main_client.ChildFrameCreationCount(), 1);
7519 EXPECT_EQ(child_client.WillSendRequestCallCount(), 1); 7519 EXPECT_EQ(child_client.WillSendRequestCallCount(), 1);
7520 EXPECT_EQ(child_client.GetCachePolicy(), 7520 EXPECT_EQ(child_client.GetCachePolicy(),
7521 WebCachePolicy::kUseProtocolCachePolicy); 7521 WebCachePolicy::kUseProtocolCachePolicy);
7522 7522
7523 FrameTestHelpers::ReloadFrame(main_frame); 7523 FrameTestHelpers::ReloadFrame(main_frame);
7524 7524
7525 // A new WebFrame should have been created, but the child WebFrameClient 7525 // A new WebFrame should have been created, but the child WebFrameClient
7526 // should be reused. 7526 // should be reused.
7527 ASSERT_NE(child_frame, ToWebLocalFrameImpl(main_frame->FirstChild())); 7527 ASSERT_NE(child_frame, ToWebLocalFrameBase(main_frame->FirstChild()));
7528 ASSERT_EQ(ToWebLocalFrameImpl(main_frame->FirstChild())->Client(), 7528 ASSERT_EQ(ToWebLocalFrameBase(main_frame->FirstChild())->Client(),
7529 &child_client); 7529 &child_client);
7530 7530
7531 EXPECT_EQ(main_client.ChildFrameCreationCount(), 2); 7531 EXPECT_EQ(main_client.ChildFrameCreationCount(), 2);
7532 EXPECT_EQ(child_client.WillSendRequestCallCount(), 2); 7532 EXPECT_EQ(child_client.WillSendRequestCallCount(), 2);
7533 7533
7534 // Sub-frames should not be forcibly revalidated. 7534 // Sub-frames should not be forcibly revalidated.
7535 // TODO(toyoshim): Will consider to revalidate main resources in sub-frames 7535 // TODO(toyoshim): Will consider to revalidate main resources in sub-frames
7536 // on reloads. Or will do only for bypassingCache. 7536 // on reloads. Or will do only for bypassingCache.
7537 EXPECT_EQ(child_client.GetCachePolicy(), 7537 EXPECT_EQ(child_client.GetCachePolicy(),
7538 WebCachePolicy::kUseProtocolCachePolicy); 7538 WebCachePolicy::kUseProtocolCachePolicy);
7539 } 7539 }
7540 7540
7541 class TestSameDocumentWebFrameClient 7541 class TestSameDocumentWebFrameClient
7542 : public FrameTestHelpers::TestWebFrameClient { 7542 : public FrameTestHelpers::TestWebFrameClient {
7543 public: 7543 public:
7544 TestSameDocumentWebFrameClient() : frame_load_type_reload_seen_(false) {} 7544 TestSameDocumentWebFrameClient() : frame_load_type_reload_seen_(false) {}
7545 7545
7546 virtual void WillSendRequest(WebURLRequest&) { 7546 virtual void WillSendRequest(WebURLRequest&) {
7547 FrameLoader& frame_loader = 7547 FrameLoader& frame_loader =
7548 ToWebLocalFrameImpl(Frame())->GetFrame()->Loader(); 7548 ToWebLocalFrameBase(Frame())->GetFrame()->Loader();
7549 if (frame_loader.ProvisionalDocumentLoader()->LoadType() == 7549 if (frame_loader.ProvisionalDocumentLoader()->LoadType() ==
7550 kFrameLoadTypeReload) 7550 kFrameLoadTypeReload)
7551 frame_load_type_reload_seen_ = true; 7551 frame_load_type_reload_seen_ = true;
7552 } 7552 }
7553 7553
7554 bool FrameLoadTypeReloadSeen() const { return frame_load_type_reload_seen_; } 7554 bool FrameLoadTypeReloadSeen() const { return frame_load_type_reload_seen_; }
7555 7555
7556 private: 7556 private:
7557 bool frame_load_type_reload_seen_; 7557 bool frame_load_type_reload_seen_;
7558 }; 7558 };
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
7751 TestHistoryWebFrameClient client; 7751 TestHistoryWebFrameClient client;
7752 FrameTestHelpers::WebViewHelper web_view_helper; 7752 FrameTestHelpers::WebViewHelper web_view_helper;
7753 web_view_helper.InitializeAndLoad("about:blank", true, &client); 7753 web_view_helper.InitializeAndLoad("about:blank", true, &client);
7754 7754
7755 WebFrame* frame = web_view_helper.WebView()->MainFrame(); 7755 WebFrame* frame = web_view_helper.WebView()->MainFrame();
7756 7756
7757 frame->ExecuteScript(WebScriptSource(WebString::FromUTF8( 7757 frame->ExecuteScript(WebScriptSource(WebString::FromUTF8(
7758 "document.body.appendChild(document.createElement('iframe'))"))); 7758 "document.body.appendChild(document.createElement('iframe'))")));
7759 7759
7760 WebFrame* iframe = frame->FirstChild(); 7760 WebFrame* iframe = frame->FirstChild();
7761 ASSERT_EQ(&client, ToWebLocalFrameImpl(iframe)->Client()); 7761 ASSERT_EQ(&client, ToWebLocalFrameBase(iframe)->Client());
7762 7762
7763 std::string url1 = base_url_ + "history.html"; 7763 std::string url1 = base_url_ + "history.html";
7764 FrameTestHelpers::LoadFrame(iframe, url1); 7764 FrameTestHelpers::LoadFrame(iframe, url1);
7765 EXPECT_EQ(url1, iframe->GetDocument().Url().GetString().Utf8()); 7765 EXPECT_EQ(url1, iframe->GetDocument().Url().GetString().Utf8());
7766 EXPECT_TRUE(client.ReplacesCurrentHistoryItem()); 7766 EXPECT_TRUE(client.ReplacesCurrentHistoryItem());
7767 7767
7768 std::string url2 = base_url_ + "find.html"; 7768 std::string url2 = base_url_ + "find.html";
7769 FrameTestHelpers::LoadFrame(iframe, url2); 7769 FrameTestHelpers::LoadFrame(iframe, url2);
7770 EXPECT_EQ(url2, iframe->GetDocument().Url().GetString().Utf8()); 7770 EXPECT_EQ(url2, iframe->GetDocument().Url().GetString().Utf8());
7771 EXPECT_FALSE(client.ReplacesCurrentHistoryItem()); 7771 EXPECT_FALSE(client.ReplacesCurrentHistoryItem());
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
7819 PaintLayerCompositor* compositor = web_view_helper.WebView()->Compositor(); 7819 PaintLayerCompositor* compositor = web_view_helper.WebView()->Compositor();
7820 ASSERT_TRUE(compositor->ScrollLayer()); 7820 ASSERT_TRUE(compositor->ScrollLayer());
7821 7821
7822 // Verify that the WebLayer is not scrollable initially. 7822 // Verify that the WebLayer is not scrollable initially.
7823 GraphicsLayer* scroll_layer = compositor->ScrollLayer(); 7823 GraphicsLayer* scroll_layer = compositor->ScrollLayer();
7824 WebLayer* web_scroll_layer = scroll_layer->PlatformLayer(); 7824 WebLayer* web_scroll_layer = scroll_layer->PlatformLayer();
7825 ASSERT_FALSE(web_scroll_layer->UserScrollableHorizontal()); 7825 ASSERT_FALSE(web_scroll_layer->UserScrollableHorizontal());
7826 ASSERT_FALSE(web_scroll_layer->UserScrollableVertical()); 7826 ASSERT_FALSE(web_scroll_layer->UserScrollableVertical());
7827 7827
7828 // Call javascript to make the layer scrollable, and verify it. 7828 // Call javascript to make the layer scrollable, and verify it.
7829 WebLocalFrameImpl* frame = 7829 WebLocalFrameBase* frame =
7830 (WebLocalFrameImpl*)web_view_helper.WebView()->MainFrame(); 7830 (WebLocalFrameBase*)web_view_helper.WebView()->MainFrame();
7831 frame->ExecuteScript(WebScriptSource("allowScroll();")); 7831 frame->ExecuteScript(WebScriptSource("allowScroll();"));
7832 web_view_helper.WebView()->UpdateAllLifecyclePhases(); 7832 web_view_helper.WebView()->UpdateAllLifecyclePhases();
7833 ASSERT_TRUE(web_scroll_layer->UserScrollableHorizontal()); 7833 ASSERT_TRUE(web_scroll_layer->UserScrollableHorizontal());
7834 ASSERT_TRUE(web_scroll_layer->UserScrollableVertical()); 7834 ASSERT_TRUE(web_scroll_layer->UserScrollableVertical());
7835 } 7835 }
7836 7836
7837 // Test that currentHistoryItem reflects the current page, not the provisional 7837 // Test that currentHistoryItem reflects the current page, not the provisional
7838 // load. 7838 // load.
7839 TEST_P(ParameterizedWebFrameTest, CurrentHistoryItem) { 7839 TEST_P(ParameterizedWebFrameTest, CurrentHistoryItem) {
7840 RegisterMockedHttpURLLoad("fixed_layout.html"); 7840 RegisterMockedHttpURLLoad("fixed_layout.html");
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
8201 base_url_ + "fullscreen_iframe.html", true, nullptr, &client, nullptr, 8201 base_url_ + "fullscreen_iframe.html", true, nullptr, &client, nullptr,
8202 ConfigureAndroid); 8202 ConfigureAndroid);
8203 int viewport_width = 640; 8203 int viewport_width = 640;
8204 int viewport_height = 480; 8204 int viewport_height = 480;
8205 client.screen_info_.rect.width = viewport_width; 8205 client.screen_info_.rect.width = viewport_width;
8206 client.screen_info_.rect.height = viewport_height; 8206 client.screen_info_.rect.height = viewport_height;
8207 web_view_helper.Resize(WebSize(viewport_width, viewport_height)); 8207 web_view_helper.Resize(WebSize(viewport_width, viewport_height));
8208 web_view_impl->UpdateAllLifecyclePhases(); 8208 web_view_impl->UpdateAllLifecyclePhases();
8209 8209
8210 Document* document = 8210 Document* document =
8211 ToWebLocalFrameImpl(web_view_helper.WebView()->MainFrame()->FirstChild()) 8211 ToWebLocalFrameBase(web_view_helper.WebView()->MainFrame()->FirstChild())
8212 ->GetFrame() 8212 ->GetFrame()
8213 ->GetDocument(); 8213 ->GetDocument();
8214 UserGestureIndicator gesture(DocumentUserGestureToken::Create(document)); 8214 UserGestureIndicator gesture(DocumentUserGestureToken::Create(document));
8215 Element* div_fullscreen = document->getElementById("div1"); 8215 Element* div_fullscreen = document->getElementById("div1");
8216 Fullscreen::RequestFullscreen(*div_fullscreen); 8216 Fullscreen::RequestFullscreen(*div_fullscreen);
8217 web_view_impl->DidEnterFullscreen(); 8217 web_view_impl->DidEnterFullscreen();
8218 web_view_impl->UpdateAllLifecyclePhases(); 8218 web_view_impl->UpdateAllLifecyclePhases();
8219 8219
8220 // Verify that the element is sized to the viewport. 8220 // Verify that the element is sized to the viewport.
8221 LayoutFullScreen* fullscreen_layout_object = 8221 LayoutFullScreen* fullscreen_layout_object =
(...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after
8825 bool did_notify_; 8825 bool did_notify_;
8826 }; 8826 };
8827 8827
8828 TEST_P(ParameterizedWebFrameTest, ThemeColor) { 8828 TEST_P(ParameterizedWebFrameTest, ThemeColor) {
8829 RegisterMockedHttpURLLoad("theme_color_test.html"); 8829 RegisterMockedHttpURLLoad("theme_color_test.html");
8830 ThemeColorTestWebFrameClient client; 8830 ThemeColorTestWebFrameClient client;
8831 FrameTestHelpers::WebViewHelper web_view_helper; 8831 FrameTestHelpers::WebViewHelper web_view_helper;
8832 web_view_helper.InitializeAndLoad(base_url_ + "theme_color_test.html", true, 8832 web_view_helper.InitializeAndLoad(base_url_ + "theme_color_test.html", true,
8833 &client); 8833 &client);
8834 EXPECT_TRUE(client.DidNotify()); 8834 EXPECT_TRUE(client.DidNotify());
8835 WebLocalFrameImpl* frame = web_view_helper.WebView()->MainFrameImpl(); 8835 WebLocalFrameBase* frame = web_view_helper.WebView()->MainFrameImpl();
8836 EXPECT_EQ(0xff0000ff, frame->GetDocument().ThemeColor()); 8836 EXPECT_EQ(0xff0000ff, frame->GetDocument().ThemeColor());
8837 // Change color by rgb. 8837 // Change color by rgb.
8838 client.Reset(); 8838 client.Reset();
8839 frame->ExecuteScript( 8839 frame->ExecuteScript(
8840 WebScriptSource("document.getElementById('tc1').setAttribute('content', " 8840 WebScriptSource("document.getElementById('tc1').setAttribute('content', "
8841 "'rgb(0, 0, 0)');")); 8841 "'rgb(0, 0, 0)');"));
8842 EXPECT_TRUE(client.DidNotify()); 8842 EXPECT_TRUE(client.DidNotify());
8843 EXPECT_EQ(0xff000000, frame->GetDocument().ThemeColor()); 8843 EXPECT_EQ(0xff000000, frame->GetDocument().ThemeColor());
8844 // Change color by hsl. 8844 // Change color by hsl.
8845 client.Reset(); 8845 client.Reset();
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
9115 } 9115 }
9116 9116
9117 TEST_F(WebFrameSwapTest, DetachProvisionalFrame) { 9117 TEST_F(WebFrameSwapTest, DetachProvisionalFrame) {
9118 FrameTestHelpers::TestWebRemoteFrameClient remote_frame_client; 9118 FrameTestHelpers::TestWebRemoteFrameClient remote_frame_client;
9119 WebRemoteFrameImpl* remote_frame = WebRemoteFrameImpl::Create( 9119 WebRemoteFrameImpl* remote_frame = WebRemoteFrameImpl::Create(
9120 WebTreeScopeType::kDocument, &remote_frame_client); 9120 WebTreeScopeType::kDocument, &remote_frame_client);
9121 SwapAndVerifyMiddleChildConsistency("local->remote", MainFrame(), 9121 SwapAndVerifyMiddleChildConsistency("local->remote", MainFrame(),
9122 remote_frame); 9122 remote_frame);
9123 9123
9124 FrameTestHelpers::TestWebFrameClient client; 9124 FrameTestHelpers::TestWebFrameClient client;
9125 WebLocalFrameImpl* provisional_frame = WebLocalFrameImpl::CreateProvisional( 9125 WebLocalFrameBase* provisional_frame =
9126 &client, nullptr, nullptr, remote_frame, WebSandboxFlags::kNone); 9126 ToWebLocalFrameBase(WebLocalFrame::CreateProvisional(
9127 &client, nullptr, nullptr, remote_frame, WebSandboxFlags::kNone));
9127 9128
9128 // The provisional frame should have a local frame owner. 9129 // The provisional frame should have a local frame owner.
9129 FrameOwner* owner = provisional_frame->GetFrame()->Owner(); 9130 FrameOwner* owner = provisional_frame->GetFrame()->Owner();
9130 ASSERT_TRUE(owner->IsLocal()); 9131 ASSERT_TRUE(owner->IsLocal());
9131 9132
9132 // But the owner should point to |remoteFrame|, since the new frame is still 9133 // But the owner should point to |remoteFrame|, since the new frame is still
9133 // provisional. 9134 // provisional.
9134 EXPECT_EQ(remote_frame->GetFrame(), owner->ContentFrame()); 9135 EXPECT_EQ(remote_frame->GetFrame(), owner->ContentFrame());
9135 9136
9136 // After detaching the provisional frame, the frame owner should still point 9137 // After detaching the provisional frame, the frame owner should still point
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
9545 TEST_F(WebFrameSwapTest, WindowOpenOnRemoteFrame) { 9546 TEST_F(WebFrameSwapTest, WindowOpenOnRemoteFrame) {
9546 RemoteNavigationClient remote_client; 9547 RemoteNavigationClient remote_client;
9547 WebRemoteFrame* remote_frame = remote_client.GetFrame(); 9548 WebRemoteFrame* remote_frame = remote_client.GetFrame();
9548 MainFrame()->FirstChild()->Swap(remote_frame); 9549 MainFrame()->FirstChild()->Swap(remote_frame);
9549 remote_frame->SetReplicatedOrigin( 9550 remote_frame->SetReplicatedOrigin(
9550 WebSecurityOrigin::CreateFromString("http://127.0.0.1")); 9551 WebSecurityOrigin::CreateFromString("http://127.0.0.1"));
9551 9552
9552 ASSERT_TRUE(MainFrame()->IsWebLocalFrame()); 9553 ASSERT_TRUE(MainFrame()->IsWebLocalFrame());
9553 ASSERT_TRUE(MainFrame()->FirstChild()->IsWebRemoteFrame()); 9554 ASSERT_TRUE(MainFrame()->FirstChild()->IsWebRemoteFrame());
9554 LocalDOMWindow* main_window = 9555 LocalDOMWindow* main_window =
9555 ToWebLocalFrameImpl(MainFrame())->GetFrame()->DomWindow(); 9556 ToWebLocalFrameBase(MainFrame())->GetFrame()->DomWindow();
9556 9557
9557 KURL destination = ToKURL("data:text/html:destination"); 9558 KURL destination = ToKURL("data:text/html:destination");
9558 NonThrowableExceptionState exception_state; 9559 NonThrowableExceptionState exception_state;
9559 main_window->open(destination.GetString(), "frame1", "", main_window, 9560 main_window->open(destination.GetString(), "frame1", "", main_window,
9560 main_window, exception_state); 9561 main_window, exception_state);
9561 ASSERT_FALSE(remote_client.LastRequest().IsNull()); 9562 ASSERT_FALSE(remote_client.LastRequest().IsNull());
9562 EXPECT_EQ(remote_client.LastRequest().Url(), WebURL(destination)); 9563 EXPECT_EQ(remote_client.LastRequest().Url(), WebURL(destination));
9563 9564
9564 // Pointing a named frame to an empty URL should just return a reference to 9565 // Pointing a named frame to an empty URL should just return a reference to
9565 // the frame's window without navigating it. 9566 // the frame's window without navigating it.
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after
10103 EXPECT_TRUE(page->Suspended()); 10104 EXPECT_TRUE(page->Suspended());
10104 } 10105 }
10105 EXPECT_FALSE(page->Suspended()); 10106 EXPECT_FALSE(page->Suspended());
10106 10107
10107 // Repeat this for a page with a local child frame, and ensure that the 10108 // Repeat this for a page with a local child frame, and ensure that the
10108 // child frame's loads are also suspended. 10109 // child frame's loads are also suspended.
10109 WebLocalFrame* web_local_child = 10110 WebLocalFrame* web_local_child =
10110 FrameTestHelpers::CreateLocalChild(remote_root); 10111 FrameTestHelpers::CreateLocalChild(remote_root);
10111 RegisterMockedHttpURLLoad("foo.html"); 10112 RegisterMockedHttpURLLoad("foo.html");
10112 FrameTestHelpers::LoadFrame(web_local_child, base_url_ + "foo.html"); 10113 FrameTestHelpers::LoadFrame(web_local_child, base_url_ + "foo.html");
10113 LocalFrame* local_child = ToWebLocalFrameImpl(web_local_child)->GetFrame(); 10114 LocalFrame* local_child = ToWebLocalFrameBase(web_local_child)->GetFrame();
10114 EXPECT_FALSE(page->Suspended()); 10115 EXPECT_FALSE(page->Suspended());
10115 EXPECT_FALSE( 10116 EXPECT_FALSE(
10116 local_child->GetDocument()->Fetcher()->Context().DefersLoading()); 10117 local_child->GetDocument()->Fetcher()->Context().DefersLoading());
10117 { 10118 {
10118 ScopedPageSuspender suspender; 10119 ScopedPageSuspender suspender;
10119 EXPECT_TRUE(page->Suspended()); 10120 EXPECT_TRUE(page->Suspended());
10120 EXPECT_TRUE( 10121 EXPECT_TRUE(
10121 local_child->GetDocument()->Fetcher()->Context().DefersLoading()); 10122 local_child->GetDocument()->Fetcher()->Context().DefersLoading());
10122 } 10123 }
10123 EXPECT_FALSE(page->Suspended()); 10124 EXPECT_FALSE(page->Suspended());
(...skipping 787 matching lines...) Expand 10 before | Expand all | Expand 10 after
10911 WebURLRequest::kPriorityLow); 10912 WebURLRequest::kPriorityLow);
10912 10913
10913 FrameTestHelpers::WebViewHelper helper; 10914 FrameTestHelpers::WebViewHelper helper;
10914 helper.Initialize(true, &client); 10915 helper.Initialize(true, &client);
10915 helper.Resize(WebSize(640, 480)); 10916 helper.Resize(WebSize(640, 480));
10916 FrameTestHelpers::LoadFrame( 10917 FrameTestHelpers::LoadFrame(
10917 helper.WebView()->MainFrame(), 10918 helper.WebView()->MainFrame(),
10918 base_url_ + "promote_img_in_viewport_priority.html"); 10919 base_url_ + "promote_img_in_viewport_priority.html");
10919 10920
10920 // Ensure the image in the viewport got promoted after the request was sent. 10921 // Ensure the image in the viewport got promoted after the request was sent.
10921 Resource* image = ToWebLocalFrameImpl(helper.WebView()->MainFrame()) 10922 Resource* image = ToWebLocalFrameBase(helper.WebView()->MainFrame())
10922 ->GetFrame() 10923 ->GetFrame()
10923 ->GetDocument() 10924 ->GetDocument()
10924 ->Fetcher() 10925 ->Fetcher()
10925 ->AllResources() 10926 ->AllResources()
10926 .at(ToKURL("http://internal.test/image_slow.pl")); 10927 .at(ToKURL("http://internal.test/image_slow.pl"));
10927 DCHECK(image); 10928 DCHECK(image);
10928 EXPECT_EQ(kResourceLoadPriorityHigh, image->GetResourceRequest().Priority()); 10929 EXPECT_EQ(kResourceLoadPriorityHigh, image->GetResourceRequest().Priority());
10929 10930
10930 client.VerifyAllRequests(); 10931 client.VerifyAllRequests();
10931 } 10932 }
(...skipping 772 matching lines...) Expand 10 before | Expand all | Expand 10 after
11704 " overflow: scroll;" 11705 " overflow: scroll;"
11705 " }" 11706 " }"
11706 " div { height:1000px; width: 200px; }" 11707 " div { height:1000px; width: 200px; }"
11707 "</style>" 11708 "</style>"
11708 "<div id='container'>" 11709 "<div id='container'>"
11709 " <div id='space'></div>" 11710 " <div id='space'></div>"
11710 "</div>", 11711 "</div>",
11711 base_url); 11712 base_url);
11712 web_view_impl->UpdateAllLifecyclePhases(); 11713 web_view_impl->UpdateAllLifecyclePhases();
11713 11714
11714 WebLocalFrameImpl* frame = web_view_helper.WebView()->MainFrameImpl(); 11715 WebLocalFrameBase* frame = web_view_helper.WebView()->MainFrameImpl();
11715 Document* document = 11716 Document* document =
11716 ToLocalFrame(web_view_impl->GetPage()->MainFrame())->GetDocument(); 11717 ToLocalFrame(web_view_impl->GetPage()->MainFrame())->GetDocument();
11717 Element* container = document->getElementById("container"); 11718 Element* container = document->getElementById("container");
11718 ScrollableArea* scrollable_area = 11719 ScrollableArea* scrollable_area =
11719 ToLayoutBox(container->GetLayoutObject())->GetScrollableArea(); 11720 ToLayoutBox(container->GetLayoutObject())->GetScrollableArea();
11720 11721
11721 EXPECT_FALSE(scrollable_area->ScrollbarsHidden()); 11722 EXPECT_FALSE(scrollable_area->ScrollbarsHidden());
11722 testing::RunDelayedTasks(kMockOverlayFadeOutDelayMs); 11723 testing::RunDelayedTasks(kMockOverlayFadeOutDelayMs);
11723 EXPECT_TRUE(scrollable_area->ScrollbarsHidden()); 11724 EXPECT_TRUE(scrollable_area->ScrollbarsHidden());
11724 11725
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
11964 FrameTestHelpers::WebViewHelper web_view_helper; 11965 FrameTestHelpers::WebViewHelper web_view_helper;
11965 WebViewBase* web_view = web_view_helper.Initialize(true); 11966 WebViewBase* web_view = web_view_helper.Initialize(true);
11966 WebRemoteFrameImpl* remote_frame = static_cast<WebRemoteFrameImpl*>( 11967 WebRemoteFrameImpl* remote_frame = static_cast<WebRemoteFrameImpl*>(
11967 WebRemoteFrame::Create(WebTreeScopeType::kDocument, nullptr)); 11968 WebRemoteFrame::Create(WebTreeScopeType::kDocument, nullptr));
11968 web_view->SetMainFrame(remote_frame); 11969 web_view->SetMainFrame(remote_frame);
11969 RefPtr<SecurityOrigin> unique_origin = SecurityOrigin::CreateUnique(); 11970 RefPtr<SecurityOrigin> unique_origin = SecurityOrigin::CreateUnique();
11970 remote_frame->GetFrame()->GetSecurityContext()->SetSecurityOrigin( 11971 remote_frame->GetFrame()->GetSecurityContext()->SetSecurityOrigin(
11971 unique_origin); 11972 unique_origin);
11972 11973
11973 ShowVirtualKeyboardObserverWidgetClient web_widget_client; 11974 ShowVirtualKeyboardObserverWidgetClient web_widget_client;
11974 WebLocalFrameImpl* local_frame = FrameTestHelpers::CreateLocalChild( 11975 WebLocalFrameBase* local_frame = FrameTestHelpers::CreateLocalChild(
11975 remote_frame, "child", nullptr, &web_widget_client); 11976 remote_frame, "child", nullptr, &web_widget_client);
11976 11977
11977 RegisterMockedHttpURLLoad("input_field_default.html"); 11978 RegisterMockedHttpURLLoad("input_field_default.html");
11978 FrameTestHelpers::LoadFrame(local_frame, 11979 FrameTestHelpers::LoadFrame(local_frame,
11979 base_url_ + "input_field_default.html"); 11980 base_url_ + "input_field_default.html");
11980 11981
11981 // Simulate an input element focus leading to Element::focus() call with a 11982 // Simulate an input element focus leading to Element::focus() call with a
11982 // user gesture. 11983 // user gesture.
11983 local_frame->SetHasReceivedUserGesture(); 11984 local_frame->SetHasReceivedUserGesture();
11984 local_frame->ExecuteScript( 11985 local_frame->ExecuteScript(
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
12072 12073
12073 TEST_F(WebFrameTest, LocalFrameWithRemoteParentIsTransparent) { 12074 TEST_F(WebFrameTest, LocalFrameWithRemoteParentIsTransparent) {
12074 FrameTestHelpers::TestWebViewClient view_client; 12075 FrameTestHelpers::TestWebViewClient view_client;
12075 FrameTestHelpers::TestWebRemoteFrameClient remote_client; 12076 FrameTestHelpers::TestWebRemoteFrameClient remote_client;
12076 WebView* view = WebView::Create(&view_client, kWebPageVisibilityStateVisible); 12077 WebView* view = WebView::Create(&view_client, kWebPageVisibilityStateVisible);
12077 view->GetSettings()->SetJavaScriptEnabled(true); 12078 view->GetSettings()->SetJavaScriptEnabled(true);
12078 view->SetMainFrame(remote_client.GetFrame()); 12079 view->SetMainFrame(remote_client.GetFrame());
12079 WebRemoteFrame* root = view->MainFrame()->ToWebRemoteFrame(); 12080 WebRemoteFrame* root = view->MainFrame()->ToWebRemoteFrame();
12080 root->SetReplicatedOrigin(SecurityOrigin::CreateUnique()); 12081 root->SetReplicatedOrigin(SecurityOrigin::CreateUnique());
12081 12082
12082 WebLocalFrameImpl* local_frame = FrameTestHelpers::CreateLocalChild(root); 12083 WebLocalFrameBase* local_frame = FrameTestHelpers::CreateLocalChild(root);
12083 FrameTestHelpers::LoadFrame(local_frame, "data:text/html,some page"); 12084 FrameTestHelpers::LoadFrame(local_frame, "data:text/html,some page");
12084 12085
12085 // Local frame with remote parent should have transparent baseBackgroundColor. 12086 // Local frame with remote parent should have transparent baseBackgroundColor.
12086 Color color = local_frame->GetFrameView()->BaseBackgroundColor(); 12087 Color color = local_frame->GetFrameView()->BaseBackgroundColor();
12087 EXPECT_EQ(Color::kTransparent, color); 12088 EXPECT_EQ(Color::kTransparent, color);
12088 12089
12089 view->Close(); 12090 view->Close();
12090 } 12091 }
12091 12092
12092 class TestFallbackWebFrameClient : public FrameTestHelpers::TestWebFrameClient { 12093 class TestFallbackWebFrameClient : public FrameTestHelpers::TestWebFrameClient {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
12125 12126
12126 TEST_F(WebFrameTest, FallbackForNonexistentProvisionalNavigation) { 12127 TEST_F(WebFrameTest, FallbackForNonexistentProvisionalNavigation) {
12127 RegisterMockedHttpURLLoad("fallback.html"); 12128 RegisterMockedHttpURLLoad("fallback.html");
12128 TestFallbackWebFrameClient mainClient; 12129 TestFallbackWebFrameClient mainClient;
12129 TestFallbackWebFrameClient childClient; 12130 TestFallbackWebFrameClient childClient;
12130 mainClient.SetChildWebFrameClient(&childClient); 12131 mainClient.SetChildWebFrameClient(&childClient);
12131 12132
12132 FrameTestHelpers::WebViewHelper webViewHelper; 12133 FrameTestHelpers::WebViewHelper webViewHelper;
12133 webViewHelper.Initialize(true, &mainClient); 12134 webViewHelper.Initialize(true, &mainClient);
12134 12135
12135 WebLocalFrameImpl* main_frame = webViewHelper.WebView()->MainFrameImpl(); 12136 WebLocalFrameBase* main_frame = webViewHelper.WebView()->MainFrameImpl();
12136 WebURLRequest request(ToKURL(base_url_ + "fallback.html")); 12137 WebURLRequest request(ToKURL(base_url_ + "fallback.html"));
12137 main_frame->LoadRequest(request); 12138 main_frame->LoadRequest(request);
12138 12139
12139 // Because the child frame will be HandledByClient, the main frame will not 12140 // Because the child frame will be HandledByClient, the main frame will not
12140 // finish loading, so we cant use 12141 // finish loading, so we cant use
12141 // FrameTestHelpers::pumpPendingRequestsForFrameToLoad. 12142 // FrameTestHelpers::pumpPendingRequestsForFrameToLoad.
12142 Platform::Current()->GetURLLoaderMockFactory()->ServeAsynchronousRequests(); 12143 Platform::Current()->GetURLLoaderMockFactory()->ServeAsynchronousRequests();
12143 12144
12144 // Overwrite the client-handled child frame navigation with about:blank. 12145 // Overwrite the client-handled child frame navigation with about:blank.
12145 WebLocalFrame* child = main_frame->FirstChild()->ToWebLocalFrame(); 12146 WebLocalFrame* child = main_frame->FirstChild()->ToWebLocalFrame();
12146 child->LoadRequest(WebURLRequest(BlankURL())); 12147 child->LoadRequest(WebURLRequest(BlankURL()));
12147 12148
12148 // Failing the original child frame navigation and trying to render fallback 12149 // Failing the original child frame navigation and trying to render fallback
12149 // content shouldn't crash. It should return NoLoadInProgress. This is so the 12150 // 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 12151 // caller won't attempt to replace the correctly empty frame with an error
12151 // page. 12152 // page.
12152 EXPECT_EQ(WebLocalFrame::NoLoadInProgress, 12153 EXPECT_EQ(WebLocalFrame::NoLoadInProgress,
12153 child->MaybeRenderFallbackContent(WebURLError())); 12154 child->MaybeRenderFallbackContent(WebURLError()));
12154 } 12155 }
12155 12156
12156 TEST_F(WebFrameTest, AltTextOnAboutBlankPage) { 12157 TEST_F(WebFrameTest, AltTextOnAboutBlankPage) {
12157 FrameTestHelpers::WebViewHelper web_view_helper; 12158 FrameTestHelpers::WebViewHelper web_view_helper;
12158 web_view_helper.InitializeAndLoad("about:blank", true); 12159 web_view_helper.InitializeAndLoad("about:blank", true);
12159 web_view_helper.Resize(WebSize(640, 480)); 12160 web_view_helper.Resize(WebSize(640, 480));
12160 WebLocalFrameImpl* frame = web_view_helper.WebView()->MainFrameImpl(); 12161 WebLocalFrameBase* frame = web_view_helper.WebView()->MainFrameImpl();
12161 12162
12162 const char kSource[] = 12163 const char kSource[] =
12163 "<img id='foo' src='foo' alt='foo alt' width='200' height='200'>"; 12164 "<img id='foo' src='foo' alt='foo alt' width='200' height='200'>";
12164 FrameTestHelpers::LoadHTMLString(frame, kSource, ToKURL("about:blank")); 12165 FrameTestHelpers::LoadHTMLString(frame, kSource, ToKURL("about:blank"));
12165 web_view_helper.WebView()->UpdateAllLifecyclePhases(); 12166 web_view_helper.WebView()->UpdateAllLifecyclePhases();
12166 RunPendingTasks(); 12167 RunPendingTasks();
12167 12168
12168 // Check LayoutText with alt text "foo alt" 12169 // Check LayoutText with alt text "foo alt"
12169 LayoutObject* layout_object = frame->GetFrame() 12170 LayoutObject* layout_object = frame->GetFrame()
12170 ->GetDocument() 12171 ->GetDocument()
12171 ->getElementById("foo") 12172 ->getElementById("foo")
12172 ->GetLayoutObject() 12173 ->GetLayoutObject()
12173 ->SlowFirstChild(); 12174 ->SlowFirstChild();
12174 String text = ""; 12175 String text = "";
12175 for (LayoutObject* obj = layout_object; obj; obj = obj->NextInPreOrder()) { 12176 for (LayoutObject* obj = layout_object; obj; obj = obj->NextInPreOrder()) {
12176 if (obj->IsText()) { 12177 if (obj->IsText()) {
12177 LayoutText* layout_text = ToLayoutText(obj); 12178 LayoutText* layout_text = ToLayoutText(obj);
12178 text = layout_text->GetText(); 12179 text = layout_text->GetText();
12179 break; 12180 break;
12180 } 12181 }
12181 } 12182 }
12182 EXPECT_EQ("foo alt", text.Utf8()); 12183 EXPECT_EQ("foo alt", text.Utf8());
12183 } 12184 }
12184 12185
12185 } // namespace blink 12186 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/tests/WebFrameSerializerTest.cpp ('k') | third_party/WebKit/Source/web/tests/WebViewTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698