Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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()); | |
|
ncarter (slow)
2015/06/05 21:47:50
<< "RenderFrameCreated was called for a RenderFram
lfg
2015/06/05 22:07:07
Done.
| |
| 48 CHECK(static_cast<RenderFrameHostImpl*>(render_frame_host) | |
| 49 ->IsRenderFrameLive()); | |
|
ncarter (slow)
2015/06/05 21:47:50
<< "RenderFrameCreated called on for a RenderFrame
lfg
2015/06/05 22:07:07
Done.
| |
| 45 } | 50 } |
| 46 | 51 |
| 47 void WebContentsObserverSanityChecker::RenderFrameDeleted( | 52 void WebContentsObserverSanityChecker::RenderFrameDeleted( |
| 48 RenderFrameHost* render_frame_host) { | 53 RenderFrameHost* render_frame_host) { |
| 49 CHECK(!web_contents_destroyed_); | 54 CHECK(!web_contents_destroyed_); |
| 50 std::pair<int, int> routing_pair = | 55 std::pair<int, int> routing_pair = |
| 51 std::make_pair(render_frame_host->GetProcess()->GetID(), | 56 std::make_pair(render_frame_host->GetProcess()->GetID(), |
| 52 render_frame_host->GetRoutingID()); | 57 render_frame_host->GetRoutingID()); |
| 53 bool was_live = !!live_routes_.erase(routing_pair); | 58 bool was_live = !!live_routes_.erase(routing_pair); |
| 54 bool was_dead_already = !deleted_routes_.insert(routing_pair).second; | 59 bool was_dead_already = !deleted_routes_.insert(routing_pair).second; |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 248 | 253 |
| 249 std::string WebContentsObserverSanityChecker::Format( | 254 std::string WebContentsObserverSanityChecker::Format( |
| 250 RenderFrameHost* render_frame_host) { | 255 RenderFrameHost* render_frame_host) { |
| 251 return base::StringPrintf( | 256 return base::StringPrintf( |
| 252 "(%d, %d -> %s)", render_frame_host->GetProcess()->GetID(), | 257 "(%d, %d -> %s)", render_frame_host->GetProcess()->GetID(), |
| 253 render_frame_host->GetRoutingID(), | 258 render_frame_host->GetRoutingID(), |
| 254 render_frame_host->GetSiteInstance()->GetSiteURL().spec().c_str()); | 259 render_frame_host->GetSiteInstance()->GetSiteURL().spec().c_str()); |
| 255 } | 260 } |
| 256 | 261 |
| 257 } // namespace content | 262 } // namespace content |
| OLD | NEW |