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

Side by Side Diff: content/browser/web_contents/web_contents_impl_unittest.cc

Issue 1008913002: Remove RenderViewHost parameter from WebContentsObserver::Did{Start|Stop}Loading. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 9 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/command_line.h" 5 #include "base/command_line.h"
6 #include "base/logging.h" 6 #include "base/logging.h"
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "content/browser/frame_host/cross_site_transferring_request.h" 8 #include "content/browser/frame_host/cross_site_transferring_request.h"
9 #include "content/browser/frame_host/interstitial_page_impl.h" 9 #include "content/browser/frame_host/interstitial_page_impl.h"
10 #include "content/browser/frame_host/navigation_entry_impl.h" 10 #include "content/browser/frame_host/navigation_entry_impl.h"
(...skipping 2746 matching lines...) Expand 10 before | Expand all | Expand 10 after
2757 } 2757 }
2758 2758
2759 class LoadingWebContentsObserver : public WebContentsObserver { 2759 class LoadingWebContentsObserver : public WebContentsObserver {
2760 public: 2760 public:
2761 explicit LoadingWebContentsObserver(WebContents* contents) 2761 explicit LoadingWebContentsObserver(WebContents* contents)
2762 : WebContentsObserver(contents), 2762 : WebContentsObserver(contents),
2763 is_loading_(false) { 2763 is_loading_(false) {
2764 } 2764 }
2765 ~LoadingWebContentsObserver() override {} 2765 ~LoadingWebContentsObserver() override {}
2766 2766
2767 void DidStartLoading(RenderViewHost* rvh) override { 2767 void DidStartLoading() override { is_loading_ = true; }
2768 is_loading_ = true; 2768 void DidStopLoading() override { is_loading_ = false; }
2769 }
2770 void DidStopLoading(RenderViewHost* rvh) override {
2771 is_loading_ = false;
2772 }
2773 2769
2774 bool is_loading() const { return is_loading_; } 2770 bool is_loading() const { return is_loading_; }
2775 2771
2776 private: 2772 private:
2777 bool is_loading_; 2773 bool is_loading_;
2778 2774
2779 DISALLOW_COPY_AND_ASSIGN(LoadingWebContentsObserver); 2775 DISALLOW_COPY_AND_ASSIGN(LoadingWebContentsObserver);
2780 }; 2776 };
2781 2777
2782 // Ensure that DidStartLoading/DidStopLoading events balance out properly with 2778 // Ensure that DidStartLoading/DidStopLoading events balance out properly with
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
3105 frame->SendBeforeUnloadHandlersPresent(false); 3101 frame->SendBeforeUnloadHandlersPresent(false);
3106 EXPECT_FALSE(frame->SuddenTerminationAllowed()); 3102 EXPECT_FALSE(frame->SuddenTerminationAllowed());
3107 frame->SendBeforeUnloadHandlersPresent(true); 3103 frame->SendBeforeUnloadHandlersPresent(true);
3108 frame->SendUnloadHandlersPresent(false); 3104 frame->SendUnloadHandlersPresent(false);
3109 EXPECT_FALSE(frame->SuddenTerminationAllowed()); 3105 EXPECT_FALSE(frame->SuddenTerminationAllowed());
3110 frame->SendBeforeUnloadHandlersPresent(false); 3106 frame->SendBeforeUnloadHandlersPresent(false);
3111 EXPECT_TRUE(frame->SuddenTerminationAllowed()); 3107 EXPECT_TRUE(frame->SuddenTerminationAllowed());
3112 } 3108 }
3113 3109
3114 } // namespace content 3110 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698