| 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/bookmarks/bookmark_bubble_sign_in_delegate.h" | 5 #include "chrome/browser/ui/bookmarks/bookmark_bubble_sign_in_delegate.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "chrome/browser/extensions/test_extension_service.h" | 10 #include "chrome/browser/extensions/test_extension_service.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 | 27 |
| 28 protected: | 28 protected: |
| 29 class Window : public TestBrowserWindow { | 29 class Window : public TestBrowserWindow { |
| 30 public: | 30 public: |
| 31 Window() : show_count_(0) {} | 31 Window() : show_count_(0) {} |
| 32 | 32 |
| 33 int show_count() { return show_count_; } | 33 int show_count() { return show_count_; } |
| 34 | 34 |
| 35 private: | 35 private: |
| 36 // TestBrowserWindow: | 36 // TestBrowserWindow: |
| 37 virtual void Show() override { | 37 void Show() override { ++show_count_; } |
| 38 ++show_count_; | |
| 39 } | |
| 40 | 38 |
| 41 // Number of times that the Show() method has been called. | 39 // Number of times that the Show() method has been called. |
| 42 int show_count_; | 40 int show_count_; |
| 43 | 41 |
| 44 DISALLOW_COPY_AND_ASSIGN(Window); | 42 DISALLOW_COPY_AND_ASSIGN(Window); |
| 45 }; | 43 }; |
| 46 | 44 |
| 47 virtual BrowserWindow* CreateBrowserWindow() override { | 45 BrowserWindow* CreateBrowserWindow() override { return new Window(); } |
| 48 return new Window(); | |
| 49 } | |
| 50 | 46 |
| 51 private: | 47 private: |
| 52 DISALLOW_COPY_AND_ASSIGN(BookmarkBubbleSignInDelegateTest); | 48 DISALLOW_COPY_AND_ASSIGN(BookmarkBubbleSignInDelegateTest); |
| 53 }; | 49 }; |
| 54 | 50 |
| 55 void BookmarkBubbleSignInDelegateTest::SetUp() { | 51 void BookmarkBubbleSignInDelegateTest::SetUp() { |
| 56 BrowserWithTestWindowTest::SetUp(); | 52 BrowserWithTestWindowTest::SetUp(); |
| 57 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 53 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 58 // Force web-based signin, otherwise tests will crash because inline signin | 54 // Force web-based signin, otherwise tests will crash because inline signin |
| 59 // involves IO thread operation. | 55 // involves IO thread operation. |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 // visible. | 140 // visible. |
| 145 int tab_count = extra_browser->tab_strip_model()->count(); | 141 int tab_count = extra_browser->tab_strip_model()->count(); |
| 146 EXPECT_EQ(starting_tab_count + 1, tab_count); | 142 EXPECT_EQ(starting_tab_count + 1, tab_count); |
| 147 EXPECT_LE(1, | 143 EXPECT_LE(1, |
| 148 static_cast<BookmarkBubbleSignInDelegateTest::Window*>( | 144 static_cast<BookmarkBubbleSignInDelegateTest::Window*>( |
| 149 extra_window.get())->show_count()); | 145 extra_window.get())->show_count()); |
| 150 | 146 |
| 151 // Required to avoid a crash when the browser is deleted. | 147 // Required to avoid a crash when the browser is deleted. |
| 152 extra_browser->tab_strip_model()->CloseAllTabs(); | 148 extra_browser->tab_strip_model()->CloseAllTabs(); |
| 153 } | 149 } |
| OLD | NEW |