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

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

Issue 1371673002: Remove a bunch of provisionalDataSource() usage. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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/WebFrameTest.cpp
diff --git a/third_party/WebKit/Source/web/tests/WebFrameTest.cpp b/third_party/WebKit/Source/web/tests/WebFrameTest.cpp
index 58b15bf43272a4f4312b4e12c38e0cc799751196..8df21adb412fcce9f226cd25d3bc27173f0eb717 100644
--- a/third_party/WebKit/Source/web/tests/WebFrameTest.cpp
+++ b/third_party/WebKit/Source/web/tests/WebFrameTest.cpp
@@ -117,6 +117,7 @@
#include "public/web/WebTextCheckingCompletion.h"
#include "public/web/WebTextCheckingResult.h"
#include "public/web/WebViewClient.h"
+#include "web/WebDataSourceImpl.h"
#include "web/WebLocalFrameImpl.h"
#include "web/WebRemoteFrameImpl.h"
#include "web/WebViewImpl.h"
@@ -5026,12 +5027,13 @@ class TestSubstituteDataWebFrameClient : public FrameTestHelpers::TestWebFrameCl
public:
TestSubstituteDataWebFrameClient()
: m_commitCalled(false)
+ , m_frame(nullptr)
{
}
- virtual void didFailProvisionalLoad(WebLocalFrame* frame, const WebURLError& error, WebHistoryCommitType)
+ virtual void didFailProvisionalLoad(WebDataSource*, const WebURLError& error, WebHistoryCommitType)
{
- frame->loadHTMLString("This should appear", toKURL("data:text/html,chromewebdata"), error.unreachableURL, true);
+ m_frame->loadHTMLString("This should appear", toKURL("data:text/html,chromewebdata"), error.unreachableURL, true);
}
virtual void didCommitProvisionalLoad(WebLocalFrame* frame, const WebHistoryItem&, WebHistoryCommitType)
@@ -5041,9 +5043,11 @@ public:
}
bool commitCalled() const { return m_commitCalled; }
+ void setFrame(WebLocalFrame* frame) { m_frame = frame; }
private:
bool m_commitCalled;
+ WebLocalFrame* m_frame;
};
TEST_P(ParameterizedWebFrameTest, ReplaceNavigationAfterHistoryNavigation)
@@ -5053,6 +5057,7 @@ TEST_P(ParameterizedWebFrameTest, ReplaceNavigationAfterHistoryNavigation)
FrameTestHelpers::WebViewHelper webViewHelper(this);
webViewHelper.initializeAndLoad("about:blank", true, &webFrameClient);
WebFrame* frame = webViewHelper.webView()->mainFrame();
+ webFrameClient.setFrame(frame->toWebLocalFrame());
// Load a url as a history navigation that will return an error. TestSubstituteDataWebFrameClient
// will start a SubstituteData load in response to the load failure, which should get fully committed.
@@ -5949,7 +5954,7 @@ public:
TestWebFrameClient::didStopLoading();
}
- void willSendRequest(WebLocalFrame* frame, unsigned, WebURLRequest& request, const WebURLResponse&) override
+ void willSendRequest(WebDataSource*, unsigned, WebURLRequest& request, const WebURLResponse&) override
{
m_policy = request.cachePolicy();
m_willSendRequestCallCount++;
@@ -6000,9 +6005,9 @@ public:
{
}
- virtual void willSendRequest(WebLocalFrame* frame, unsigned, WebURLRequest&, const WebURLResponse&)
+ virtual void willSendRequest(WebDataSource* dataSource, unsigned, WebURLRequest&, const WebURLResponse&)
{
- if (toWebLocalFrameImpl(frame)->frame()->loader().loadType() == FrameLoadTypeSame)
+ if (static_cast<WebDataSourceImpl*>(dataSource)->frame()->loader().loadType() == FrameLoadTypeSame)
m_frameLoadTypeSameSeen = true;
}
@@ -6034,7 +6039,7 @@ public:
{
}
- virtual void willSendRequest(WebLocalFrame* frame, unsigned, WebURLRequest& request, const WebURLResponse&)
+ virtual void willSendRequest(WebDataSource*, unsigned, WebURLRequest& request, const WebURLResponse&)
{
if (request.requestContext() == WebURLRequest::RequestContextImage) {
m_numOfImageRequests++;
@@ -6172,22 +6177,17 @@ public:
TestHistoryWebFrameClient()
{
m_replacesCurrentHistoryItem = false;
- m_frame = nullptr;
}
- void didStartProvisionalLoad(WebLocalFrame* frame, double)
+ void didStartProvisionalLoad(WebDataSource* ds, double)
{
- WebDataSource* ds = frame->provisionalDataSource();
m_replacesCurrentHistoryItem = ds->replacesCurrentHistoryItem();
- m_frame = frame;
}
bool replacesCurrentHistoryItem() { return m_replacesCurrentHistoryItem; }
- WebFrame* frame() { return m_frame; }
private:
bool m_replacesCurrentHistoryItem;
- WebFrame* m_frame;
};
// Tests that the first navigation in an initially blank subframe will result in
@@ -6208,17 +6208,14 @@ TEST_P(ParameterizedWebFrameTest, FirstBlankSubframeNavigation)
WebFrame* iframe = frame->firstChild();
ASSERT_EQ(&client, toWebLocalFrameImpl(iframe)->client());
- EXPECT_EQ(iframe, client.frame());
std::string url1 = m_baseURL + "history.html";
FrameTestHelpers::loadFrame(iframe, url1);
- EXPECT_EQ(iframe, client.frame());
EXPECT_EQ(url1, iframe->document().url().string().utf8());
EXPECT_TRUE(client.replacesCurrentHistoryItem());
std::string url2 = m_baseURL + "find.html";
FrameTestHelpers::loadFrame(iframe, url2);
- EXPECT_EQ(iframe, client.frame());
EXPECT_EQ(url2, iframe->document().url().string().utf8());
EXPECT_FALSE(client.replacesCurrentHistoryItem());
}
@@ -6243,12 +6240,10 @@ TEST_P(ParameterizedWebFrameTest, FirstNonBlankSubframeNavigation)
"document.body.appendChild(f)");
WebFrame* iframe = frame->firstChild();
- EXPECT_EQ(iframe, client.frame());
EXPECT_EQ(url1, iframe->document().url().string().utf8());
std::string url2 = m_baseURL + "find.html";
FrameTestHelpers::loadFrame(iframe, url2);
- EXPECT_EQ(iframe, client.frame());
EXPECT_EQ(url2, iframe->document().url().string().utf8());
EXPECT_FALSE(client.replacesCurrentHistoryItem());
}
« no previous file with comments | « third_party/WebKit/Source/web/WebSharedWorkerImpl.cpp ('k') | third_party/WebKit/public/web/WebFrameClient.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698