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

Side by Side Diff: chrome/browser/ui/views/frame/browser_view_browsertest.cc

Issue 686463004: Standardize usage of virtual/override/final specifiers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 1 month 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "chrome/browser/ui/views/frame/browser_view.h" 5 #include "chrome/browser/ui/views/frame/browser_view.h"
6 6
7 #include "base/prefs/pref_service.h" 7 #include "base/prefs/pref_service.h"
8 #include "chrome/browser/devtools/devtools_window_testing.h" 8 #include "chrome/browser/devtools/devtools_window_testing.h"
9 #include "chrome/browser/ui/browser.h" 9 #include "chrome/browser/ui/browser.h"
10 #include "chrome/browser/ui/browser_tabstrip.h" 10 #include "chrome/browser/ui/browser_tabstrip.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 namespace { 58 namespace {
59 59
60 // Used to simulate scenario in a crash. When WebContentsDestroyed() is invoked 60 // Used to simulate scenario in a crash. When WebContentsDestroyed() is invoked
61 // updates the navigation state of another tab. 61 // updates the navigation state of another tab.
62 class TestWebContentsObserver : public content::WebContentsObserver { 62 class TestWebContentsObserver : public content::WebContentsObserver {
63 public: 63 public:
64 TestWebContentsObserver(content::WebContents* source, 64 TestWebContentsObserver(content::WebContents* source,
65 content::WebContents* other) 65 content::WebContents* other)
66 : content::WebContentsObserver(source), 66 : content::WebContentsObserver(source),
67 other_(other) {} 67 other_(other) {}
68 virtual ~TestWebContentsObserver() {} 68 ~TestWebContentsObserver() override {}
69 69
70 virtual void WebContentsDestroyed() override { 70 void WebContentsDestroyed() override {
71 other_->NotifyNavigationStateChanged(static_cast<content::InvalidateTypes>( 71 other_->NotifyNavigationStateChanged(static_cast<content::InvalidateTypes>(
72 content::INVALIDATE_TYPE_URL | content::INVALIDATE_TYPE_LOAD)); 72 content::INVALIDATE_TYPE_URL | content::INVALIDATE_TYPE_LOAD));
73 } 73 }
74 74
75 private: 75 private:
76 content::WebContents* other_; 76 content::WebContents* other_;
77 77
78 DISALLOW_COPY_AND_ASSIGN(TestWebContentsObserver); 78 DISALLOW_COPY_AND_ASSIGN(TestWebContentsObserver);
79 }; 79 };
80 80
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 175
176 class BookmarkBarViewObserverImpl : public BookmarkBarViewObserver { 176 class BookmarkBarViewObserverImpl : public BookmarkBarViewObserver {
177 public: 177 public:
178 BookmarkBarViewObserverImpl() : change_count_(0) { 178 BookmarkBarViewObserverImpl() : change_count_(0) {
179 } 179 }
180 180
181 int change_count() const { return change_count_; } 181 int change_count() const { return change_count_; }
182 void clear_change_count() { change_count_ = 0; } 182 void clear_change_count() { change_count_ = 0; }
183 183
184 // BookmarkBarViewObserver: 184 // BookmarkBarViewObserver:
185 virtual void OnBookmarkBarVisibilityChanged() override { 185 void OnBookmarkBarVisibilityChanged() override { change_count_++; }
186 change_count_++;
187 }
188 186
189 private: 187 private:
190 int change_count_; 188 int change_count_;
191 189
192 DISALLOW_COPY_AND_ASSIGN(BookmarkBarViewObserverImpl); 190 DISALLOW_COPY_AND_ASSIGN(BookmarkBarViewObserverImpl);
193 }; 191 };
194 192
195 // Verifies we don't unnecessarily change the visibility of the BookmarkBarView. 193 // Verifies we don't unnecessarily change the visibility of the BookmarkBarView.
196 IN_PROC_BROWSER_TEST_F(BrowserViewTest, AvoidUnnecessaryVisibilityChanges) { 194 IN_PROC_BROWSER_TEST_F(BrowserViewTest, AvoidUnnecessaryVisibilityChanges) {
197 // Create two tabs, the first empty and the second the ntp. Make it so the 195 // Create two tabs, the first empty and the second the ntp. Make it so the
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 EXPECT_EQ(0, observer.change_count()); 230 EXPECT_EQ(0, observer.change_count());
233 observer.clear_change_count(); 231 observer.clear_change_count();
234 232
235 browser()->tab_strip_model()->ActivateTabAt(1, true); 233 browser()->tab_strip_model()->ActivateTabAt(1, true);
236 EXPECT_TRUE(bookmark_bar->visible()); 234 EXPECT_TRUE(bookmark_bar->visible());
237 EXPECT_EQ(0, observer.change_count()); 235 EXPECT_EQ(0, observer.change_count());
238 observer.clear_change_count(); 236 observer.clear_change_count();
239 237
240 browser_view()->bookmark_bar()->RemoveObserver(&observer); 238 browser_view()->bookmark_bar()->RemoveObserver(&observer);
241 } 239 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/frame/browser_view.cc ('k') | chrome/browser/ui/views/frame/browser_view_layout.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698