| OLD | NEW |
| 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 virtual ~TestWebContentsObserver() {} |
| 69 | 69 |
| 70 virtual void WebContentsDestroyed() OVERRIDE { | 70 virtual 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 Loading... |
| 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 virtual void OnBookmarkBarVisibilityChanged() override { |
| 186 change_count_++; | 186 change_count_++; |
| 187 } | 187 } |
| 188 | 188 |
| 189 private: | 189 private: |
| 190 int change_count_; | 190 int change_count_; |
| 191 | 191 |
| 192 DISALLOW_COPY_AND_ASSIGN(BookmarkBarViewObserverImpl); | 192 DISALLOW_COPY_AND_ASSIGN(BookmarkBarViewObserverImpl); |
| 193 }; | 193 }; |
| 194 | 194 |
| 195 // Verifies we don't unnecessarily change the visibility of the BookmarkBarView. | 195 // Verifies we don't unnecessarily change the visibility of the BookmarkBarView. |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 EXPECT_EQ(0, observer.change_count()); | 232 EXPECT_EQ(0, observer.change_count()); |
| 233 observer.clear_change_count(); | 233 observer.clear_change_count(); |
| 234 | 234 |
| 235 browser()->tab_strip_model()->ActivateTabAt(1, true); | 235 browser()->tab_strip_model()->ActivateTabAt(1, true); |
| 236 EXPECT_TRUE(bookmark_bar->visible()); | 236 EXPECT_TRUE(bookmark_bar->visible()); |
| 237 EXPECT_EQ(0, observer.change_count()); | 237 EXPECT_EQ(0, observer.change_count()); |
| 238 observer.clear_change_count(); | 238 observer.clear_change_count(); |
| 239 | 239 |
| 240 browser_view()->bookmark_bar()->RemoveObserver(&observer); | 240 browser_view()->bookmark_bar()->RemoveObserver(&observer); |
| 241 } | 241 } |
| OLD | NEW |