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

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

Issue 628213003: Replace OVERRIDE and FINAL with override and final in content/browser/web_contents (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
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 #include "base/command_line.h" 5 #include "base/command_line.h"
6 #include "base/strings/stringprintf.h" 6 #include "base/strings/stringprintf.h"
7 #include "content/public/browser/web_contents.h" 7 #include "content/public/browser/web_contents.h"
8 #include "content/public/browser/web_contents_delegate.h" 8 #include "content/public/browser/web_contents_delegate.h"
9 #include "content/public/common/content_switches.h" 9 #include "content/public/common/content_switches.h"
10 #include "content/public/test/browser_test_utils.h" 10 #include "content/public/test/browser_test_utils.h"
(...skipping 10 matching lines...) Expand all
21 21
22 // A dummy WebContentsDelegate which tracks whether CloseContents() has been 22 // A dummy WebContentsDelegate which tracks whether CloseContents() has been
23 // called. It refuses the actual close but keeps track of whether the renderer 23 // called. It refuses the actual close but keeps track of whether the renderer
24 // requested it. 24 // requested it.
25 class CloseTrackingDelegate : public WebContentsDelegate { 25 class CloseTrackingDelegate : public WebContentsDelegate {
26 public: 26 public:
27 CloseTrackingDelegate() : close_contents_called_(false) {} 27 CloseTrackingDelegate() : close_contents_called_(false) {}
28 28
29 bool close_contents_called() const { return close_contents_called_; } 29 bool close_contents_called() const { return close_contents_called_; }
30 30
31 virtual void CloseContents(WebContents* source) OVERRIDE { 31 virtual void CloseContents(WebContents* source) override {
32 close_contents_called_ = true; 32 close_contents_called_ = true;
33 } 33 }
34 34
35 private: 35 private:
36 bool close_contents_called_; 36 bool close_contents_called_;
37 37
38 DISALLOW_COPY_AND_ASSIGN(CloseTrackingDelegate); 38 DISALLOW_COPY_AND_ASSIGN(CloseTrackingDelegate);
39 }; 39 };
40 40
41 } // namespace 41 } // namespace
42 42
43 class OpenedByDOMTest : public ContentBrowserTest { 43 class OpenedByDOMTest : public ContentBrowserTest {
44 protected: 44 protected:
45 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { 45 virtual void SetUpCommandLine(CommandLine* command_line) override {
46 // Use --site-per-process to force process swaps on cross-site navigations. 46 // Use --site-per-process to force process swaps on cross-site navigations.
47 command_line->AppendSwitch(switches::kSitePerProcess); 47 command_line->AppendSwitch(switches::kSitePerProcess);
48 } 48 }
49 49
50 bool AttemptCloseFromJavaScript(WebContents* web_contents) { 50 bool AttemptCloseFromJavaScript(WebContents* web_contents) {
51 CloseTrackingDelegate close_tracking_delegate; 51 CloseTrackingDelegate close_tracking_delegate;
52 WebContentsDelegate* old_delegate = web_contents->GetDelegate(); 52 WebContentsDelegate* old_delegate = web_contents->GetDelegate();
53 web_contents->SetDelegate(&close_tracking_delegate); 53 web_contents->SetDelegate(&close_tracking_delegate);
54 54
55 const char kCloseWindowScript[] = 55 const char kCloseWindowScript[] =
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 url3 = url3.ReplaceComponents(replace_host); 131 url3 = url3.ReplaceComponents(replace_host);
132 132
133 NavigateToURL(shell(), url1); 133 NavigateToURL(shell(), url1);
134 134
135 Shell* popup = OpenWindowFromJavaScript(shell(), url2); 135 Shell* popup = OpenWindowFromJavaScript(shell(), url2);
136 NavigateToURL(popup, url3); 136 NavigateToURL(popup, url3);
137 EXPECT_TRUE(AttemptCloseFromJavaScript(popup->web_contents())); 137 EXPECT_TRUE(AttemptCloseFromJavaScript(popup->web_contents()));
138 } 138 }
139 139
140 } // namespace content 140 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/web_contents/aura/window_slider_unittest.cc ('k') | content/browser/web_contents/touch_editable_impl_aura.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698