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

Side by Side Diff: content/test/web_contents_observer_sanity_checker.cc

Issue 1159143008: Fix wrong initialization of renderer_initiated_creation parameter. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressing mmenke@'s comments Created 5 years, 6 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
« no previous file with comments | « content/browser/web_contents/web_contents_impl.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "content/test/web_contents_observer_sanity_checker.h" 5 #include "content/test/web_contents_observer_sanity_checker.h"
6 6
7 #include "base/strings/stringprintf.h" 7 #include "base/strings/stringprintf.h"
8 #include "content/browser/frame_host/render_frame_host_impl.h"
8 #include "content/common/frame_messages.h" 9 #include "content/common/frame_messages.h"
9 #include "content/public/browser/render_frame_host.h" 10 #include "content/public/browser/render_frame_host.h"
10 #include "content/public/browser/render_process_host.h" 11 #include "content/public/browser/render_process_host.h"
11 #include "content/public/browser/site_instance.h" 12 #include "content/public/browser/site_instance.h"
12 #include "content/public/browser/web_contents.h" 13 #include "content/public/browser/web_contents.h"
13 #include "content/public/browser/web_contents_observer.h" 14 #include "content/public/browser/web_contents_observer.h"
14 15
15 namespace content { 16 namespace content {
16 17
17 namespace { 18 namespace {
(...skipping 17 matching lines...) Expand all
35 std::pair<int, int> routing_pair = 36 std::pair<int, int> routing_pair =
36 std::make_pair(render_frame_host->GetProcess()->GetID(), 37 std::make_pair(render_frame_host->GetProcess()->GetID(),
37 render_frame_host->GetRoutingID()); 38 render_frame_host->GetRoutingID());
38 bool frame_exists = !live_routes_.insert(routing_pair).second; 39 bool frame_exists = !live_routes_.insert(routing_pair).second;
39 deleted_routes_.erase(routing_pair); 40 deleted_routes_.erase(routing_pair);
40 41
41 if (frame_exists) { 42 if (frame_exists) {
42 CHECK(false) << "RenderFrameCreated called more than once for routing pair:" 43 CHECK(false) << "RenderFrameCreated called more than once for routing pair:"
43 << Format(render_frame_host); 44 << Format(render_frame_host);
44 } 45 }
46
47 CHECK(render_frame_host->GetProcess()->HasConnection())
48 << "RenderFrameCreated was called for a RenderFrameHost whose render "
49 "process is not currently live, so there's no way for the RenderFrame "
50 "to have been created.";
51 CHECK(
52 static_cast<RenderFrameHostImpl*>(render_frame_host)->IsRenderFrameLive())
53 << "RenderFrameCreated called on for a RenderFrameHost that thinks it is "
54 "not alive.";
45 } 55 }
46 56
47 void WebContentsObserverSanityChecker::RenderFrameDeleted( 57 void WebContentsObserverSanityChecker::RenderFrameDeleted(
48 RenderFrameHost* render_frame_host) { 58 RenderFrameHost* render_frame_host) {
49 CHECK(!web_contents_destroyed_); 59 CHECK(!web_contents_destroyed_);
50 std::pair<int, int> routing_pair = 60 std::pair<int, int> routing_pair =
51 std::make_pair(render_frame_host->GetProcess()->GetID(), 61 std::make_pair(render_frame_host->GetProcess()->GetID(),
52 render_frame_host->GetRoutingID()); 62 render_frame_host->GetRoutingID());
53 bool was_live = !!live_routes_.erase(routing_pair); 63 bool was_live = !!live_routes_.erase(routing_pair);
54 bool was_dead_already = !deleted_routes_.insert(routing_pair).second; 64 bool was_dead_already = !deleted_routes_.insert(routing_pair).second;
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 258
249 std::string WebContentsObserverSanityChecker::Format( 259 std::string WebContentsObserverSanityChecker::Format(
250 RenderFrameHost* render_frame_host) { 260 RenderFrameHost* render_frame_host) {
251 return base::StringPrintf( 261 return base::StringPrintf(
252 "(%d, %d -> %s)", render_frame_host->GetProcess()->GetID(), 262 "(%d, %d -> %s)", render_frame_host->GetProcess()->GetID(),
253 render_frame_host->GetRoutingID(), 263 render_frame_host->GetRoutingID(),
254 render_frame_host->GetSiteInstance()->GetSiteURL().spec().c_str()); 264 render_frame_host->GetSiteInstance()->GetSiteURL().spec().c_str());
255 } 265 }
256 266
257 } // namespace content 267 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/web_contents/web_contents_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698