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

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

Issue 2842833003: Update SupportsUserData uses with unique_ptr. (Closed)
Patch Set: rebase 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 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 #ifndef CONTENT_TEST_WEB_CONTENTS_OBSERVER_SANITY_CHECKER_H_ 5 #ifndef CONTENT_TEST_WEB_CONTENTS_OBSERVER_SANITY_CHECKER_H_
6 #define CONTENT_TEST_WEB_CONTENTS_OBSERVER_SANITY_CHECKER_H_ 6 #define CONTENT_TEST_WEB_CONTENTS_OBSERVER_SANITY_CHECKER_H_
7 7
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 10
(...skipping 12 matching lines...) Expand all
23 // checks are test-only code designed to find bugs in the implementation of the 23 // checks are test-only code designed to find bugs in the implementation of the
24 // content layer by validating the contract between WebContents and its 24 // content layer by validating the contract between WebContents and its
25 // observers. 25 // observers.
26 // 26 //
27 // For example, WebContentsObserver::RenderFrameCreated announces the existence 27 // For example, WebContentsObserver::RenderFrameCreated announces the existence
28 // of a new RenderFrameHost, so that method call must occur before the 28 // of a new RenderFrameHost, so that method call must occur before the
29 // RenderFrameHost is referenced by some other WebContentsObserver method. 29 // RenderFrameHost is referenced by some other WebContentsObserver method.
30 class WebContentsObserverSanityChecker : public WebContentsObserver, 30 class WebContentsObserverSanityChecker : public WebContentsObserver,
31 public base::SupportsUserData::Data { 31 public base::SupportsUserData::Data {
32 public: 32 public:
33 ~WebContentsObserverSanityChecker() override;
34
33 // Enables these checks on |web_contents|. Usually ContentBrowserSanityChecker 35 // Enables these checks on |web_contents|. Usually ContentBrowserSanityChecker
34 // should call this for you. 36 // should call this for you.
35 static void Enable(WebContents* web_contents); 37 static void Enable(WebContents* web_contents);
36 38
37 // WebContentsObserver implementation. 39 // WebContentsObserver implementation.
38 void RenderFrameCreated(RenderFrameHost* render_frame_host) override; 40 void RenderFrameCreated(RenderFrameHost* render_frame_host) override;
39 void RenderFrameDeleted(RenderFrameHost* render_frame_host) override; 41 void RenderFrameDeleted(RenderFrameHost* render_frame_host) override;
40 void RenderFrameForInterstitialPageCreated( 42 void RenderFrameForInterstitialPageCreated(
41 RenderFrameHost* render_frame_host) override; 43 RenderFrameHost* render_frame_host) override;
42 void RenderFrameHostChanged(RenderFrameHost* old_host, 44 void RenderFrameHostChanged(RenderFrameHost* old_host,
(...skipping 26 matching lines...) Expand all
69 void MediaStoppedPlaying(const MediaPlayerInfo& media_info, 71 void MediaStoppedPlaying(const MediaPlayerInfo& media_info,
70 const MediaPlayerId& id) override; 72 const MediaPlayerId& id) override;
71 bool OnMessageReceived(const IPC::Message& message, 73 bool OnMessageReceived(const IPC::Message& message,
72 RenderFrameHost* render_frame_host) override; 74 RenderFrameHost* render_frame_host) override;
73 void WebContentsDestroyed() override; 75 void WebContentsDestroyed() override;
74 void DidStartLoading() override; 76 void DidStartLoading() override;
75 void DidStopLoading() override; 77 void DidStopLoading() override;
76 78
77 private: 79 private:
78 explicit WebContentsObserverSanityChecker(WebContents* web_contents); 80 explicit WebContentsObserverSanityChecker(WebContents* web_contents);
79 ~WebContentsObserverSanityChecker() override;
80 81
81 std::string Format(RenderFrameHost* render_frame_host); 82 std::string Format(RenderFrameHost* render_frame_host);
82 void AssertRenderFrameExists(RenderFrameHost* render_frame_host); 83 void AssertRenderFrameExists(RenderFrameHost* render_frame_host);
83 void AssertMainFrameExists(); 84 void AssertMainFrameExists();
84 85
85 bool NavigationIsOngoing(NavigationHandle* navigation_handle); 86 bool NavigationIsOngoing(NavigationHandle* navigation_handle);
86 87
87 void EnsureStableParentValue(RenderFrameHost* render_frame_host); 88 void EnsureStableParentValue(RenderFrameHost* render_frame_host);
88 bool HasAnyChildren(RenderFrameHost* render_frame_host); 89 bool HasAnyChildren(RenderFrameHost* render_frame_host);
89 90
(...skipping 10 matching lines...) Expand all
100 bool is_loading_; 101 bool is_loading_;
101 102
102 bool web_contents_destroyed_; 103 bool web_contents_destroyed_;
103 104
104 DISALLOW_COPY_AND_ASSIGN(WebContentsObserverSanityChecker); 105 DISALLOW_COPY_AND_ASSIGN(WebContentsObserverSanityChecker);
105 }; 106 };
106 107
107 } // namespace content 108 } // namespace content
108 109
109 #endif // CONTENT_TEST_WEB_CONTENTS_OBSERVER_SANITY_CHECKER_H_ 110 #endif // CONTENT_TEST_WEB_CONTENTS_OBSERVER_SANITY_CHECKER_H_
OLDNEW
« no previous file with comments | « content/renderer/mojo_bindings_controller.cc ('k') | content/test/web_contents_observer_sanity_checker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698