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

Unified Diff: third_party/WebKit/Source/web/tests/FrameTestHelpers.cpp

Issue 1635873003: Replicating WebFrame::uniqueName across renderers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@dump-render-tree3
Patch Set: Rebasing... Created 4 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/web/tests/FrameTestHelpers.cpp
diff --git a/third_party/WebKit/Source/web/tests/FrameTestHelpers.cpp b/third_party/WebKit/Source/web/tests/FrameTestHelpers.cpp
index 348e7c37195dc7fabd288211993cee12a8729fad..7ab13dc0f7557f9b25430ef4a62cce3370435f9c 100644
--- a/third_party/WebKit/Source/web/tests/FrameTestHelpers.cpp
+++ b/third_party/WebKit/Source/web/tests/FrameTestHelpers.cpp
@@ -40,6 +40,7 @@
#include "public/platform/WebURLResponse.h"
#include "public/platform/WebUnitTestSupport.h"
#include "public/web/WebFrameWidget.h"
+#include "public/web/WebRemoteFrame.h"
#include "public/web/WebSettings.h"
#include "public/web/WebTreeScopeType.h"
#include "public/web/WebViewClient.h"
@@ -47,6 +48,7 @@
#include "web/WebRemoteFrameImpl.h"
#include "wtf/Functional.h"
#include "wtf/StdLibExtras.h"
+#include "wtf/text/StringBuilder.h"
namespace blink {
namespace FrameTestHelpers {
@@ -140,6 +142,22 @@ void pumpPendingRequestsDoNotUse(WebFrame* frame)
pumpPendingRequests(frame);
}
+WebLocalFrame* createLocalChild(WebRemoteFrame* parent, const WebString& name, WebFrameClient* client, WebFrame* previousSibling, const WebFrameOwnerProperties& properties)
+{
+ if (!client)
+ client = defaultWebFrameClient();
+
+ // |uniqueName| is normally calculated in a somewhat complicated way by the
+ // FrameTree class, but for test purposes the approximation below should be
+ // close enough.
+ static int uniqueNameCounter = 0;
+ StringBuilder uniqueName;
+ uniqueName.append(name);
+ uniqueName.appendNumber(uniqueNameCounter++);
+
+ return parent->createLocalChild(WebTreeScopeType::Document, name, uniqueName.toString(), WebSandboxFlags::None, client, previousSibling, properties);
+}
+
WebViewHelper::WebViewHelper(SettingOverrider* settingOverrider)
: m_webView(nullptr)
, m_webViewWidget(nullptr)
@@ -223,7 +241,7 @@ TestWebFrameClient::TestWebFrameClient() : m_loadsInProgress(0)
{
}
-WebFrame* TestWebFrameClient::createChildFrame(WebLocalFrame* parent, WebTreeScopeType scope, const WebString& frameName, WebSandboxFlags sandboxFlags, const WebFrameOwnerProperties& frameOwnerProperties)
+WebFrame* TestWebFrameClient::createChildFrame(WebLocalFrame* parent, WebTreeScopeType scope, const WebString& name, const WebString& uniqueName, WebSandboxFlags sandboxFlags, const WebFrameOwnerProperties& frameOwnerProperties)
{
WebFrame* frame = WebLocalFrame::create(scope, this);
parent->appendChild(frame);
« no previous file with comments | « third_party/WebKit/Source/web/tests/FrameTestHelpers.h ('k') | third_party/WebKit/Source/web/tests/FrameThrottlingTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698