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

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

Issue 232133004: Split WebLocalFrame into a distinct subclass of WebFrame. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 8 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 | Annotate | Revision Log
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 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 { 232 {
233 registerMockedHttpURLLoad("iframes_test.html"); 233 registerMockedHttpURLLoad("iframes_test.html");
234 registerMockedHttpURLLoad("visible_iframe.html"); 234 registerMockedHttpURLLoad("visible_iframe.html");
235 registerMockedHttpURLLoad("invisible_iframe.html"); 235 registerMockedHttpURLLoad("invisible_iframe.html");
236 registerMockedHttpURLLoad("zero_sized_iframe.html"); 236 registerMockedHttpURLLoad("zero_sized_iframe.html");
237 237
238 FrameTestHelpers::WebViewHelper webViewHelper; 238 FrameTestHelpers::WebViewHelper webViewHelper;
239 webViewHelper.initializeAndLoad(m_baseURL + "iframes_test.html", true); 239 webViewHelper.initializeAndLoad(m_baseURL + "iframes_test.html", true);
240 240
241 v8::HandleScope scope(v8::Isolate::GetCurrent()); 241 v8::HandleScope scope(v8::Isolate::GetCurrent());
242 EXPECT_EQ(webViewHelper.webView()->mainFrame(), WebFrame::frameForContext(we bViewHelper.webView()->mainFrame()->mainWorldScriptContext())); 242 EXPECT_EQ(webViewHelper.webView()->mainFrame(), WebLocalFrame::frameForConte xt(webViewHelper.webView()->mainFrame()->mainWorldScriptContext()));
243 EXPECT_EQ(webViewHelper.webView()->mainFrame()->firstChild(), WebFrame::fram eForContext(webViewHelper.webView()->mainFrame()->firstChild()->mainWorldScriptC ontext())); 243 EXPECT_EQ(webViewHelper.webView()->mainFrame()->firstChild(), WebLocalFrame: :frameForContext(webViewHelper.webView()->mainFrame()->firstChild()->mainWorldSc riptContext()));
244 } 244 }
245 245
246 TEST_F(WebFrameTest, FormWithNullFrame) 246 TEST_F(WebFrameTest, FormWithNullFrame)
247 { 247 {
248 registerMockedHttpURLLoad("form.html"); 248 registerMockedHttpURLLoad("form.html");
249 249
250 FrameTestHelpers::WebViewHelper webViewHelper; 250 FrameTestHelpers::WebViewHelper webViewHelper;
251 webViewHelper.initializeAndLoad(m_baseURL + "form.html"); 251 webViewHelper.initializeAndLoad(m_baseURL + "form.html");
252 252
253 WebVector<WebFormElement> forms; 253 WebVector<WebFormElement> forms;
(...skipping 4670 matching lines...) Expand 10 before | Expand all | Expand 10 after
4924 } 4924 }
4925 4925
4926 void setChildWebFrameClient(WebFrameClient* client) { m_client = client; } 4926 void setChildWebFrameClient(WebFrameClient* client) { m_client = client; }
4927 WebURLRequest::CachePolicy cachePolicy() const { return m_policy; } 4927 WebURLRequest::CachePolicy cachePolicy() const { return m_policy; }
4928 int willSendRequestCallCount() const { return m_willSendRequestCallCount; } 4928 int willSendRequestCallCount() const { return m_willSendRequestCallCount; }
4929 int childFrameCreationCount() const { return m_childFrameCreationCount; } 4929 int childFrameCreationCount() const { return m_childFrameCreationCount; }
4930 4930
4931 virtual WebFrame* createChildFrame(WebLocalFrame* parent, const WebString&) 4931 virtual WebFrame* createChildFrame(WebLocalFrame* parent, const WebString&)
4932 { 4932 {
4933 m_childFrameCreationCount++; 4933 m_childFrameCreationCount++;
4934 WebFrame* frame = WebFrame::create(m_client); 4934 WebFrame* frame = WebLocalFrame::create(m_client);
4935 parent->appendChild(frame); 4935 parent->appendChild(frame);
4936 return frame; 4936 return frame;
4937 } 4937 }
4938 4938
4939 virtual void frameDetached(WebFrame* frame) OVERRIDE 4939 virtual void frameDetached(WebFrame* frame) OVERRIDE
4940 { 4940 {
4941 if (frame->parent()) 4941 if (frame->parent())
4942 frame->parent()->removeChild(frame); 4942 frame->parent()->removeChild(frame);
4943 frame->close(); 4943 frame->close();
4944 } 4944 }
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after
5467 EXPECT_EQ(2U, container->percentHeightDescendants()->size()); 5467 EXPECT_EQ(2U, container->percentHeightDescendants()->size());
5468 EXPECT_TRUE(container->percentHeightDescendants()->contains(percentHeightInA nonymous)); 5468 EXPECT_TRUE(container->percentHeightDescendants()->contains(percentHeightInA nonymous));
5469 EXPECT_TRUE(container->percentHeightDescendants()->contains(percentHeightDir ectChild)); 5469 EXPECT_TRUE(container->percentHeightDescendants()->contains(percentHeightDir ectChild));
5470 5470
5471 WebCore::RenderBlock* anonymousBlock = percentHeightInAnonymous->containingB lock(); 5471 WebCore::RenderBlock* anonymousBlock = percentHeightInAnonymous->containingB lock();
5472 EXPECT_TRUE(anonymousBlock->isAnonymous()); 5472 EXPECT_TRUE(anonymousBlock->isAnonymous());
5473 EXPECT_FALSE(anonymousBlock->hasPercentHeightDescendants()); 5473 EXPECT_FALSE(anonymousBlock->hasPercentHeightDescendants());
5474 } 5474 }
5475 5475
5476 } // namespace 5476 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698