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 "build/build_config.h" | 8 #include "build/build_config.h" |
9 #include "content/browser/frame_host/render_frame_host_impl.h" | 9 #include "content/browser/frame_host/render_frame_host_impl.h" |
10 #include "content/common/frame_messages.h" | 10 #include "content/common/frame_messages.h" |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
325 return false; | 325 return false; |
326 } | 326 } |
327 | 327 |
328 void WebContentsObserverSanityChecker::WebContentsDestroyed() { | 328 void WebContentsObserverSanityChecker::WebContentsDestroyed() { |
329 CHECK(!web_contents_destroyed_); | 329 CHECK(!web_contents_destroyed_); |
330 web_contents_destroyed_ = true; | 330 web_contents_destroyed_ = true; |
331 CHECK(ongoing_navigations_.empty()); | 331 CHECK(ongoing_navigations_.empty()); |
332 CHECK(active_media_players_.empty()); | 332 CHECK(active_media_players_.empty()); |
333 } | 333 } |
334 | 334 |
335 void WebContentsObserverSanityChecker::DidStartLoading() { | |
336 CHECK(!is_loading_); | |
337 is_loading_ = true; | |
nasko
2016/01/20 20:58:34
Now that we have the loading state, we should asse
clamy
2016/01/22 13:08:15
Will do that in a separate CL. Added a TODO for it
| |
338 } | |
339 | |
340 void WebContentsObserverSanityChecker::DidStopLoading() { | |
341 CHECK(is_loading_); | |
342 is_loading_ = false; | |
343 } | |
344 | |
335 WebContentsObserverSanityChecker::WebContentsObserverSanityChecker( | 345 WebContentsObserverSanityChecker::WebContentsObserverSanityChecker( |
336 WebContents* web_contents) | 346 WebContents* web_contents) |
337 : WebContentsObserver(web_contents), web_contents_destroyed_(false) { | 347 : WebContentsObserver(web_contents), |
338 } | 348 is_loading_(false), |
349 web_contents_destroyed_(false) {} | |
339 | 350 |
340 WebContentsObserverSanityChecker::~WebContentsObserverSanityChecker() { | 351 WebContentsObserverSanityChecker::~WebContentsObserverSanityChecker() { |
341 CHECK(web_contents_destroyed_); | 352 CHECK(web_contents_destroyed_); |
342 } | 353 } |
343 | 354 |
344 void WebContentsObserverSanityChecker::AssertRenderFrameExists( | 355 void WebContentsObserverSanityChecker::AssertRenderFrameExists( |
345 RenderFrameHost* render_frame_host) { | 356 RenderFrameHost* render_frame_host) { |
346 CHECK(!web_contents_destroyed_); | 357 CHECK(!web_contents_destroyed_); |
347 GlobalRoutingID routing_pair = GetRoutingPair(render_frame_host); | 358 GlobalRoutingID routing_pair = GetRoutingPair(render_frame_host); |
348 | 359 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
400 if (live_routes_.count(entry.first)) | 411 if (live_routes_.count(entry.first)) |
401 return true; | 412 return true; |
402 if (current_hosts_.count(entry.first)) | 413 if (current_hosts_.count(entry.first)) |
403 return true; | 414 return true; |
404 } | 415 } |
405 } | 416 } |
406 return false; | 417 return false; |
407 } | 418 } |
408 | 419 |
409 } // namespace content | 420 } // namespace content |
OLD | NEW |