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

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

Issue 2907663004: FrameTree::Find only searches relative to local frames. (Closed)
Patch Set: Addressed CR feedback Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 #include "public/web/WebSettings.h" 149 #include "public/web/WebSettings.h"
150 #include "public/web/WebTextCheckClient.h" 150 #include "public/web/WebTextCheckClient.h"
151 #include "public/web/WebTextCheckingCompletion.h" 151 #include "public/web/WebTextCheckingCompletion.h"
152 #include "public/web/WebTextCheckingResult.h" 152 #include "public/web/WebTextCheckingResult.h"
153 #include "public/web/WebViewClient.h" 153 #include "public/web/WebViewClient.h"
154 #include "testing/gmock/include/gmock/gmock.h" 154 #include "testing/gmock/include/gmock/gmock.h"
155 #include "testing/gtest/include/gtest/gtest.h" 155 #include "testing/gtest/include/gtest/gtest.h"
156 #include "v8/include/v8.h" 156 #include "v8/include/v8.h"
157 #include "web/TextFinder.h" 157 #include "web/TextFinder.h"
158 #include "web/WebRemoteFrameImpl.h" 158 #include "web/WebRemoteFrameImpl.h"
159 #include "web/WebViewImpl.h"
159 #include "web/tests/FrameTestHelpers.h" 160 #include "web/tests/FrameTestHelpers.h"
160 #include "web/tests/sim/SimDisplayItemList.h" 161 #include "web/tests/sim/SimDisplayItemList.h"
161 #include "web/tests/sim/SimRequest.h" 162 #include "web/tests/sim/SimRequest.h"
162 #include "web/tests/sim/SimTest.h" 163 #include "web/tests/sim/SimTest.h"
163 164
164 using blink::URLTestHelpers::ToKURL; 165 using blink::URLTestHelpers::ToKURL;
165 using blink::testing::RunPendingTasks; 166 using blink::testing::RunPendingTasks;
166 using testing::ElementsAre; 167 using testing::ElementsAre;
167 using testing::Mock; 168 using testing::Mock;
168 using testing::_; 169 using testing::_;
(...skipping 4197 matching lines...) Expand 10 before | Expand all | Expand 10 after
4366 RegisterMockedHttpURLLoad("iframe_redirect.html"); 4367 RegisterMockedHttpURLLoad("iframe_redirect.html");
4367 RegisterMockedHttpURLLoad("visible_iframe.html"); 4368 RegisterMockedHttpURLLoad("visible_iframe.html");
4368 4369
4369 FrameTestHelpers::WebViewHelper web_view_helper; 4370 FrameTestHelpers::WebViewHelper web_view_helper;
4370 web_view_helper.InitializeAndLoad(base_url_ + "iframe_redirect.html", true); 4371 web_view_helper.InitializeAndLoad(base_url_ + "iframe_redirect.html", true);
4371 // Pump pending requests one more time. The test page loads script that 4372 // Pump pending requests one more time. The test page loads script that
4372 // navigates. 4373 // navigates.
4373 FrameTestHelpers::PumpPendingRequestsForFrameToLoad( 4374 FrameTestHelpers::PumpPendingRequestsForFrameToLoad(
4374 web_view_helper.WebView()->MainFrame()); 4375 web_view_helper.WebView()->MainFrame());
4375 4376
4376 WebFrame* iframe = web_view_helper.WebView()->FindFrameByName( 4377 WebFrame* iframe = static_cast<WebViewImpl*>(web_view_helper.WebView())
dcheng 2017/05/26 20:16:19 WebView() already returns a WebViewImpl, no static
Łukasz Anforowicz 2017/05/26 20:51:19 Doh - thanks for pointing this out. Done (but sti
4377 WebString::FromUTF8("ifr"), nullptr); 4378 ->MainFrameImpl()
4379 ->FindFrameByName(WebString::FromUTF8("ifr"));
4378 ASSERT_TRUE(iframe); 4380 ASSERT_TRUE(iframe);
4379 WebDataSource* iframe_data_source = iframe->DataSource(); 4381 WebDataSource* iframe_data_source = iframe->DataSource();
4380 ASSERT_TRUE(iframe_data_source); 4382 ASSERT_TRUE(iframe_data_source);
4381 WebVector<WebURL> redirects; 4383 WebVector<WebURL> redirects;
4382 iframe_data_source->RedirectChain(redirects); 4384 iframe_data_source->RedirectChain(redirects);
4383 ASSERT_EQ(2U, redirects.size()); 4385 ASSERT_EQ(2U, redirects.size());
4384 EXPECT_EQ(ToKURL("about:blank"), KURL(redirects[0])); 4386 EXPECT_EQ(ToKURL("about:blank"), KURL(redirects[0]));
4385 EXPECT_EQ(ToKURL("http://internal.test/visible_iframe.html"), 4387 EXPECT_EQ(ToKURL("http://internal.test/visible_iframe.html"),
4386 KURL(redirects[1])); 4388 KURL(redirects[1]));
4387 } 4389 }
(...skipping 7789 matching lines...) Expand 10 before | Expand all | Expand 10 after
12177 if (obj->IsText()) { 12179 if (obj->IsText()) {
12178 LayoutText* layout_text = ToLayoutText(obj); 12180 LayoutText* layout_text = ToLayoutText(obj);
12179 text = layout_text->GetText(); 12181 text = layout_text->GetText();
12180 break; 12182 break;
12181 } 12183 }
12182 } 12184 }
12183 EXPECT_EQ("foo alt", text.Utf8()); 12185 EXPECT_EQ("foo alt", text.Utf8());
12184 } 12186 }
12185 12187
12186 } // namespace blink 12188 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/tests/LayoutGeometryMapTest.cpp ('k') | third_party/WebKit/public/web/WebLocalFrame.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698