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

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

Issue 2562323002: Devirtualize Frame::domWindow(). (Closed)
Patch Set: Created 4 years 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 983 matching lines...) Expand 10 before | Expand all | Expand 10 after
994 994
995 TEST_P(ParameterizedWebFrameTest, PostMessageThenDetach) { 995 TEST_P(ParameterizedWebFrameTest, PostMessageThenDetach) {
996 FrameTestHelpers::WebViewHelper webViewHelper; 996 FrameTestHelpers::WebViewHelper webViewHelper;
997 webViewHelper.initializeAndLoad("about:blank"); 997 webViewHelper.initializeAndLoad("about:blank");
998 998
999 LocalFrame* frame = 999 LocalFrame* frame =
1000 toLocalFrame(webViewHelper.webView()->page()->mainFrame()); 1000 toLocalFrame(webViewHelper.webView()->page()->mainFrame());
1001 NonThrowableExceptionState exceptionState; 1001 NonThrowableExceptionState exceptionState;
1002 MessagePortArray messagePorts; 1002 MessagePortArray messagePorts;
1003 frame->domWindow()->postMessage(SerializedScriptValue::serialize("message"), 1003 frame->domWindow()->postMessage(SerializedScriptValue::serialize("message"),
1004 messagePorts, "*", frame->localDOMWindow(), 1004 messagePorts, "*", frame->domWindow(),
1005 exceptionState); 1005 exceptionState);
1006 webViewHelper.reset(); 1006 webViewHelper.reset();
1007 EXPECT_FALSE(exceptionState.hadException()); 1007 EXPECT_FALSE(exceptionState.hadException());
1008 1008
1009 // Success is not crashing. 1009 // Success is not crashing.
1010 runPendingTasks(); 1010 runPendingTasks();
1011 } 1011 }
1012 1012
1013 namespace { 1013 namespace {
1014 1014
(...skipping 8127 matching lines...) Expand 10 before | Expand all | Expand 10 after
9142 TEST_F(WebFrameSwapTest, WindowOpenOnRemoteFrame) { 9142 TEST_F(WebFrameSwapTest, WindowOpenOnRemoteFrame) {
9143 RemoteNavigationClient remoteClient; 9143 RemoteNavigationClient remoteClient;
9144 WebRemoteFrame* remoteFrame = remoteClient.frame(); 9144 WebRemoteFrame* remoteFrame = remoteClient.frame();
9145 mainFrame()->firstChild()->swap(remoteFrame); 9145 mainFrame()->firstChild()->swap(remoteFrame);
9146 remoteFrame->setReplicatedOrigin( 9146 remoteFrame->setReplicatedOrigin(
9147 WebSecurityOrigin::createFromString("http://127.0.0.1")); 9147 WebSecurityOrigin::createFromString("http://127.0.0.1"));
9148 9148
9149 ASSERT_TRUE(mainFrame()->isWebLocalFrame()); 9149 ASSERT_TRUE(mainFrame()->isWebLocalFrame());
9150 ASSERT_TRUE(mainFrame()->firstChild()->isWebRemoteFrame()); 9150 ASSERT_TRUE(mainFrame()->firstChild()->isWebRemoteFrame());
9151 LocalDOMWindow* mainWindow = 9151 LocalDOMWindow* mainWindow =
9152 toWebLocalFrameImpl(mainFrame())->frame()->localDOMWindow(); 9152 toWebLocalFrameImpl(mainFrame())->frame()->domWindow();
9153 9153
9154 KURL destination = toKURL("data:text/html:destination"); 9154 KURL destination = toKURL("data:text/html:destination");
9155 mainWindow->open(destination.getString(), "frame1", "", mainWindow, 9155 mainWindow->open(destination.getString(), "frame1", "", mainWindow,
9156 mainWindow); 9156 mainWindow);
9157 ASSERT_FALSE(remoteClient.lastRequest().isNull()); 9157 ASSERT_FALSE(remoteClient.lastRequest().isNull());
9158 EXPECT_EQ(remoteClient.lastRequest().url(), WebURL(destination)); 9158 EXPECT_EQ(remoteClient.lastRequest().url(), WebURL(destination));
9159 9159
9160 // Pointing a named frame to an empty URL should just return a reference to 9160 // Pointing a named frame to an empty URL should just return a reference to
9161 // the frame's window without navigating it. 9161 // the frame's window without navigating it.
9162 DOMWindow* result = 9162 DOMWindow* result =
(...skipping 1926 matching lines...) Expand 10 before | Expand all | Expand 10 after
11089 11089
11090 EXPECT_TRUE(mainFrameClient.childClient().didCallFrameDetached()); 11090 EXPECT_TRUE(mainFrameClient.childClient().didCallFrameDetached());
11091 EXPECT_TRUE(mainFrameClient.childClient().didCallDidStopLoading()); 11091 EXPECT_TRUE(mainFrameClient.childClient().didCallDidStopLoading());
11092 EXPECT_TRUE(mainFrameClient.childClient().didCallDidFinishDocumentLoad()); 11092 EXPECT_TRUE(mainFrameClient.childClient().didCallDidFinishDocumentLoad());
11093 EXPECT_TRUE(mainFrameClient.childClient().didCallDidHandleOnloadEvents()); 11093 EXPECT_TRUE(mainFrameClient.childClient().didCallDidHandleOnloadEvents());
11094 11094
11095 webViewHelper.reset(); 11095 webViewHelper.reset();
11096 } 11096 }
11097 11097
11098 } // namespace blink 11098 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698