Commit 0458471b authored by Dave Tapuska's avatar Dave Tapuska Committed by Chromium LUCI CQ

Change DOMSerilizerTests to use a frame token instead of a view routing id.

The code used a view routing ID to access the appropriate WebFrame.
It is more appropriate to lookup via the frame token.

BUG=1155202

Change-Id: I364525848a2cb37343814216598724040acbf0ef
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2572042Reviewed-by: default avatardanakj <danakj@chromium.org>
Commit-Queue: Dave Tapuska <dtapuska@chromium.org>
Cr-Commit-Position: refs/heads/master@{#833414}
parent b3a83588
...@@ -86,11 +86,8 @@ class MAYBE_DomSerializerTests : public ContentBrowserTest, ...@@ -86,11 +86,8 @@ class MAYBE_DomSerializerTests : public ContentBrowserTest,
} }
void SetUpOnMainThread() override { void SetUpOnMainThread() override {
render_view_routing_id_ = shell() main_frame_token_ =
->web_contents() shell()->web_contents()->GetMainFrame()->GetFrameToken();
->GetMainFrame()
->GetRenderViewHost()
->GetRoutingID();
} }
// DomSerializerDelegate. // DomSerializerDelegate.
...@@ -107,16 +104,10 @@ class MAYBE_DomSerializerTests : public ContentBrowserTest, ...@@ -107,16 +104,10 @@ class MAYBE_DomSerializerTests : public ContentBrowserTest,
serialization_reported_end_of_data_ = true; serialization_reported_end_of_data_ = true;
} }
RenderView* GetRenderView() { WebView* GetWebView() { return GetMainFrame()->View(); }
return RenderView::FromRoutingID(render_view_routing_id_);
}
WebView* GetWebView() {
return GetRenderView()->GetWebView();
}
WebLocalFrame* GetMainFrame() { WebLocalFrame* GetMainFrame() {
return GetRenderView()->GetMainRenderFrame()->GetWebFrame(); return WebFrame::FromFrameToken(main_frame_token_)->ToWebLocalFrame();
} }
WebLocalFrame* FindSubFrameByURL(const GURL& url) { WebLocalFrame* FindSubFrameByURL(const GURL& url) {
...@@ -139,11 +130,8 @@ class MAYBE_DomSerializerTests : public ContentBrowserTest, ...@@ -139,11 +130,8 @@ class MAYBE_DomSerializerTests : public ContentBrowserTest,
navigation_observer.Wait(); navigation_observer.Wait();
// After navigations, the RenderView for the new document might be a new // After navigations, the RenderView for the new document might be a new
// one. // one.
render_view_routing_id_ = shell() main_frame_token_ =
->web_contents() shell()->web_contents()->GetMainFrame()->GetFrameToken();
->GetMainFrame()
->GetRenderViewHost()
->GetRoutingID();
} }
class SingleLinkRewritingDelegate class SingleLinkRewritingDelegate
...@@ -198,7 +186,7 @@ class MAYBE_DomSerializerTests : public ContentBrowserTest, ...@@ -198,7 +186,7 @@ class MAYBE_DomSerializerTests : public ContentBrowserTest,
private: private:
// Written only on the browser main UI thread. Read only from the in-process // Written only on the browser main UI thread. Read only from the in-process
// renderer thread via posted tasks: // renderer thread via posted tasks:
int32_t render_view_routing_id_ = -1; base::UnguessableToken main_frame_token_;
std::string serialized_contents_; std::string serialized_contents_;
bool serialization_reported_end_of_data_ = false; bool serialization_reported_end_of_data_ = false;
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment