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

Side by Side Diff: headless/lib/frame_id_browsertest.cc

Issue 2872543002: Headless: Move GetUntrustedDevToolsFrameIdForFrameTreeNodeId to public (Closed)
Patch Set: Created 3 years, 7 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
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/bind.h" 5 #include "base/bind.h"
6 #include "base/run_loop.h" 6 #include "base/run_loop.h"
7 #include "content/public/test/browser_test.h" 7 #include "content/public/test/browser_test.h"
8 #include "headless/lib/browser/headless_browser_context_impl.h" 8 #include "headless/lib/browser/headless_browser_context_impl.h"
9 #include "headless/lib/browser/headless_web_contents_impl.h" 9 #include "headless/lib/browser/headless_web_contents_impl.h"
10 #include "headless/public/devtools/domains/network.h" 10 #include "headless/public/devtools/domains/network.h"
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 // network::Observer implementation: 232 // network::Observer implementation:
233 void OnRequestWillBeSent( 233 void OnRequestWillBeSent(
234 const network::RequestWillBeSentParams& params) override { 234 const network::RequestWillBeSentParams& params) override {
235 url_to_frame_id_[params.GetRequest()->GetUrl()] = params.GetFrameId(); 235 url_to_frame_id_[params.GetRequest()->GetUrl()] = params.GetFrameId();
236 } 236 }
237 237
238 // page::Observer implementation: 238 // page::Observer implementation:
239 void OnLoadEventFired(const page::LoadEventFiredParams& params) override { 239 void OnLoadEventFired(const page::LoadEventFiredParams& params) override {
240 std::map<std::string, std::string> protocol_handler_url_to_frame_id_; 240 std::map<std::string, std::string> protocol_handler_url_to_frame_id_;
241 for (const auto& pair : http_handler_->url_to_frame_tree_node_id_) { 241 for (const auto& pair : http_handler_->url_to_frame_tree_node_id_) {
242 HeadlessWebContentsImpl* headless_web_contents_impl =
243 static_cast<HeadlessWebContentsImpl*>(web_contents_);
244 // TODO(alexclarke): This will probably break with OOPIF, fix this. 242 // TODO(alexclarke): This will probably break with OOPIF, fix this.
245 // See https://bugs.chromium.org/p/chromium/issues/detail?id=715924 243 // See https://bugs.chromium.org/p/chromium/issues/detail?id=715924
246 protocol_handler_url_to_frame_id_[pair.first] = 244 protocol_handler_url_to_frame_id_[pair.first] =
247 headless_web_contents_impl 245 web_contents_->GetUntrustedDevToolsFrameIdForFrameTreeNodeId(
248 ->GetUntrustedDevToolsFrameIdForFrameTreeNodeId( 246 web_contents_->GetMainFrameRenderProcessId(), pair.second);
249 headless_web_contents_impl->GetMainFrameRenderProcessId(),
250 pair.second);
251 } 247 }
252 248
253 EXPECT_THAT(url_to_frame_id_, protocol_handler_url_to_frame_id_); 249 EXPECT_THAT(url_to_frame_id_, protocol_handler_url_to_frame_id_);
254 EXPECT_EQ(6u, url_to_frame_id_.size()); 250 EXPECT_EQ(6u, url_to_frame_id_.size());
255 FinishAsynchronousTest(); 251 FinishAsynchronousTest();
256 } 252 }
257 253
258 private: 254 private:
259 std::map<std::string, std::string> url_to_frame_id_; 255 std::map<std::string, std::string> url_to_frame_id_;
260 TestProtocolHandler* http_handler_; // NOT OWNED 256 TestProtocolHandler* http_handler_; // NOT OWNED
261 }; 257 };
262 258
263 HEADLESS_ASYNC_DEVTOOLED_TEST_F(FrameIdTest); 259 HEADLESS_ASYNC_DEVTOOLED_TEST_F(FrameIdTest);
264 260
265 } // namespace headless 261 } // namespace headless
OLDNEW
« no previous file with comments | « headless/lib/browser/headless_web_contents_impl.h ('k') | headless/public/headless_web_contents.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698