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

Side by Side Diff: content/browser/site_per_process_browsertest.cc

Issue 667943003: Standardize usage of virtual/override/final in content/browser/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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/site_per_process_browsertest.h ('k') | content/browser/speech/audio_encoder.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "content/browser/site_per_process_browsertest.h" 5 #include "content/browser/site_per_process_browsertest.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/strings/stringprintf.h" 8 #include "base/strings/stringprintf.h"
9 #include "content/browser/frame_host/cross_process_frame_connector.h" 9 #include "content/browser/frame_host/cross_process_frame_connector.h"
10 #include "content/browser/frame_host/frame_tree.h" 10 #include "content/browser/frame_host/frame_tree.h"
(...skipping 16 matching lines...) Expand all
27 #include "net/dns/mock_host_resolver.h" 27 #include "net/dns/mock_host_resolver.h"
28 #include "net/test/embedded_test_server/embedded_test_server.h" 28 #include "net/test/embedded_test_server/embedded_test_server.h"
29 29
30 namespace content { 30 namespace content {
31 31
32 class SitePerProcessWebContentsObserver: public WebContentsObserver { 32 class SitePerProcessWebContentsObserver: public WebContentsObserver {
33 public: 33 public:
34 explicit SitePerProcessWebContentsObserver(WebContents* web_contents) 34 explicit SitePerProcessWebContentsObserver(WebContents* web_contents)
35 : WebContentsObserver(web_contents), 35 : WebContentsObserver(web_contents),
36 navigation_succeeded_(false) {} 36 navigation_succeeded_(false) {}
37 virtual ~SitePerProcessWebContentsObserver() {} 37 ~SitePerProcessWebContentsObserver() override {}
38 38
39 virtual void DidStartProvisionalLoadForFrame( 39 void DidStartProvisionalLoadForFrame(RenderFrameHost* render_frame_host,
40 RenderFrameHost* render_frame_host, 40 const GURL& validated_url,
41 const GURL& validated_url, 41 bool is_error_page,
42 bool is_error_page, 42 bool is_iframe_srcdoc) override {
43 bool is_iframe_srcdoc) override {
44 navigation_succeeded_ = false; 43 navigation_succeeded_ = false;
45 } 44 }
46 45
47 virtual void DidFailProvisionalLoad( 46 void DidFailProvisionalLoad(
48 RenderFrameHost* render_frame_host, 47 RenderFrameHost* render_frame_host,
49 const GURL& validated_url, 48 const GURL& validated_url,
50 int error_code, 49 int error_code,
51 const base::string16& error_description) override { 50 const base::string16& error_description) override {
52 navigation_url_ = validated_url; 51 navigation_url_ = validated_url;
53 navigation_succeeded_ = false; 52 navigation_succeeded_ = false;
54 } 53 }
55 54
56 virtual void DidCommitProvisionalLoadForFrame( 55 void DidCommitProvisionalLoadForFrame(
57 RenderFrameHost* render_frame_host, 56 RenderFrameHost* render_frame_host,
58 const GURL& url, 57 const GURL& url,
59 ui::PageTransition transition_type) override { 58 ui::PageTransition transition_type) override {
60 navigation_url_ = url; 59 navigation_url_ = url;
61 navigation_succeeded_ = true; 60 navigation_succeeded_ = true;
62 } 61 }
63 62
64 const GURL& navigation_url() const { 63 const GURL& navigation_url() const {
65 return navigation_url_; 64 return navigation_url_;
66 } 65 }
67 66
68 int navigation_succeeded() const { return navigation_succeeded_; } 67 int navigation_succeeded() const { return navigation_succeeded_; }
69 68
70 private: 69 private:
71 GURL navigation_url_; 70 GURL navigation_url_;
72 bool navigation_succeeded_; 71 bool navigation_succeeded_;
73 72
74 DISALLOW_COPY_AND_ASSIGN(SitePerProcessWebContentsObserver); 73 DISALLOW_COPY_AND_ASSIGN(SitePerProcessWebContentsObserver);
75 }; 74 };
76 75
77 class RedirectNotificationObserver : public NotificationObserver { 76 class RedirectNotificationObserver : public NotificationObserver {
78 public: 77 public:
79 // Register to listen for notifications of the given type from either a 78 // Register to listen for notifications of the given type from either a
80 // specific source, or from all sources if |source| is 79 // specific source, or from all sources if |source| is
81 // NotificationService::AllSources(). 80 // NotificationService::AllSources().
82 RedirectNotificationObserver(int notification_type, 81 RedirectNotificationObserver(int notification_type,
83 const NotificationSource& source); 82 const NotificationSource& source);
84 virtual ~RedirectNotificationObserver(); 83 ~RedirectNotificationObserver() override;
85 84
86 // Wait until the specified notification occurs. If the notification was 85 // Wait until the specified notification occurs. If the notification was
87 // emitted between the construction of this object and this call then it 86 // emitted between the construction of this object and this call then it
88 // returns immediately. 87 // returns immediately.
89 void Wait(); 88 void Wait();
90 89
91 // Returns NotificationService::AllSources() if we haven't observed a 90 // Returns NotificationService::AllSources() if we haven't observed a
92 // notification yet. 91 // notification yet.
93 const NotificationSource& source() const { 92 const NotificationSource& source() const {
94 return source_; 93 return source_;
95 } 94 }
96 95
97 const NotificationDetails& details() const { 96 const NotificationDetails& details() const {
98 return details_; 97 return details_;
99 } 98 }
100 99
101 // NotificationObserver: 100 // NotificationObserver:
102 virtual void Observe(int type, 101 void Observe(int type,
103 const NotificationSource& source, 102 const NotificationSource& source,
104 const NotificationDetails& details) override; 103 const NotificationDetails& details) override;
105 104
106 private: 105 private:
107 bool seen_; 106 bool seen_;
108 bool seen_twice_; 107 bool seen_twice_;
109 bool running_; 108 bool running_;
110 NotificationRegistrar registrar_; 109 NotificationRegistrar registrar_;
111 110
112 NotificationSource source_; 111 NotificationSource source_;
113 NotificationDetails details_; 112 NotificationDetails details_;
114 scoped_refptr<MessageLoopRunner> message_loop_runner_; 113 scoped_refptr<MessageLoopRunner> message_loop_runner_;
(...skipping 650 matching lines...) Expand 10 before | Expand all | Expand 10 after
765 } 764 }
766 765
767 navigation_observer.Wait(); 766 navigation_observer.Wait();
768 EXPECT_EQ(cross_site_url, observer.navigation_url()); 767 EXPECT_EQ(cross_site_url, observer.navigation_url());
769 EXPECT_TRUE(observer.navigation_succeeded()); 768 EXPECT_TRUE(observer.navigation_succeeded());
770 EXPECT_EQ(0U, child->child_count()); 769 EXPECT_EQ(0U, child->child_count());
771 } 770 }
772 } 771 }
773 772
774 } // namespace content 773 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/site_per_process_browsertest.h ('k') | content/browser/speech/audio_encoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698