| 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 | 69 |
| 70 // A new tab should have been opened and the browser should be visible. | 70 // A new tab should have been opened and the browser should be visible. |
| 71 int tab_count = browser()->tab_strip_model()->count(); | 71 int tab_count = browser()->tab_strip_model()->count(); |
| 72 EXPECT_EQ(starting_tab_count + 1, tab_count); | 72 EXPECT_EQ(starting_tab_count + 1, tab_count); |
| 73 EXPECT_LE(1, | 73 EXPECT_LE(1, |
| 74 static_cast<BookmarkBubbleSignInDelegateTest::Window*>( | 74 static_cast<BookmarkBubbleSignInDelegateTest::Window*>( |
| 75 browser()->window())->show_count()); | 75 browser()->window())->show_count()); |
| 76 } | 76 } |
| 77 | 77 |
| 78 TEST_F(BookmarkBubbleSignInDelegateTest, OnSignInLinkClickedIncognito) { | 78 TEST_F(BookmarkBubbleSignInDelegateTest, OnSignInLinkClickedIncognito) { |
| 79 // Create an incognito browser. | |
| 80 TestingProfile::Builder incognito_profile_builder; | |
| 81 incognito_profile_builder.SetIncognito(); | |
| 82 scoped_ptr<TestingProfile> incognito_profile = | |
| 83 incognito_profile_builder.Build(); | |
| 84 incognito_profile->SetOriginalProfile(profile()); | |
| 85 profile()->SetOffTheRecordProfile(incognito_profile.PassAs<Profile>()); | |
| 86 | |
| 87 scoped_ptr<BrowserWindow> incognito_window; | 79 scoped_ptr<BrowserWindow> incognito_window; |
| 88 incognito_window.reset(CreateBrowserWindow()); | 80 incognito_window.reset(CreateBrowserWindow()); |
| 89 Browser::CreateParams params(browser()->profile()->GetOffTheRecordProfile(), | 81 Browser::CreateParams params(browser()->profile()->GetOffTheRecordProfile(), |
| 90 browser()->host_desktop_type()); | 82 browser()->host_desktop_type()); |
| 91 params.window = incognito_window.get(); | 83 params.window = incognito_window.get(); |
| 92 scoped_ptr<Browser> incognito_browser; | 84 scoped_ptr<Browser> incognito_browser; |
| 93 incognito_browser.reset(new Browser(params)); | 85 incognito_browser.reset(new Browser(params)); |
| 94 | 86 |
| 95 int starting_tab_count_normal = browser()->tab_strip_model()->count(); | 87 int starting_tab_count_normal = browser()->tab_strip_model()->count(); |
| 96 int starting_tab_count_incognito = | 88 int starting_tab_count_incognito = |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 // visible. | 138 // visible. |
| 147 int tab_count = extra_browser->tab_strip_model()->count(); | 139 int tab_count = extra_browser->tab_strip_model()->count(); |
| 148 EXPECT_EQ(starting_tab_count + 1, tab_count); | 140 EXPECT_EQ(starting_tab_count + 1, tab_count); |
| 149 EXPECT_LE(1, | 141 EXPECT_LE(1, |
| 150 static_cast<BookmarkBubbleSignInDelegateTest::Window*>( | 142 static_cast<BookmarkBubbleSignInDelegateTest::Window*>( |
| 151 extra_window.get())->show_count()); | 143 extra_window.get())->show_count()); |
| 152 | 144 |
| 153 // Required to avoid a crash when the browser is deleted. | 145 // Required to avoid a crash when the browser is deleted. |
| 154 extra_browser->tab_strip_model()->CloseAllTabs(); | 146 extra_browser->tab_strip_model()->CloseAllTabs(); |
| 155 } | 147 } |
| OLD | NEW |