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 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_sync_promo_controller.h" | 5 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_sync_promo_controller.h" |
6 | 6 |
7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
11 #include "base/mac/scoped_nsobject.h" | 11 #include "base/mac/scoped_nsobject.h" |
12 #include "chrome/browser/extensions/extension_service.h" | 12 #include "chrome/browser/extensions/extension_service.h" |
13 #include "chrome/browser/extensions/test_extension_system.h" | 13 #include "chrome/browser/extensions/test_extension_system.h" |
14 #include "chrome/browser/ui/browser.h" | 14 #include "chrome/browser/ui/browser.h" |
15 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 15 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
16 #include "chrome/test/base/browser_with_test_window_test.h" | 16 #include "chrome/test/base/browser_with_test_window_test.h" |
17 #include "components/signin/core/common/profile_management_switches.h" | |
18 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
19 | 18 |
20 namespace { | 19 namespace { |
21 | 20 |
22 class BookmarkSyncPromoControllerTest : public BrowserWithTestWindowTest { | 21 class BookmarkSyncPromoControllerTest : public BrowserWithTestWindowTest { |
23 public: | 22 public: |
24 void SetUp() override { | 23 void SetUp() override { |
25 switches::DisableNewAvatarMenuForTesting( | |
26 base::CommandLine::ForCurrentProcess()); | |
27 BrowserWithTestWindowTest::SetUp(); | 24 BrowserWithTestWindowTest::SetUp(); |
28 ASSERT_TRUE(profile()); | 25 ASSERT_TRUE(profile()); |
29 // Adds TestExtensionSystem, since signin uses the gaia auth extension. | 26 // Adds TestExtensionSystem, since signin uses the gaia auth extension. |
30 static_cast<extensions::TestExtensionSystem*>( | 27 static_cast<extensions::TestExtensionSystem*>( |
31 extensions::ExtensionSystem::Get(profile())) | 28 extensions::ExtensionSystem::Get(profile())) |
32 ->CreateExtensionService(base::CommandLine::ForCurrentProcess(), | 29 ->CreateExtensionService(base::CommandLine::ForCurrentProcess(), |
33 base::FilePath(), false); | 30 base::FilePath(), false); |
34 } | 31 } |
35 }; | 32 }; |
36 | 33 |
37 TEST_F(BookmarkSyncPromoControllerTest, SignInLink) { | 34 TEST_F(BookmarkSyncPromoControllerTest, SignInLink) { |
38 int starting_tab_count = browser()->tab_strip_model()->count(); | 35 int starting_tab_count = browser()->tab_strip_model()->count(); |
39 | 36 |
40 base::scoped_nsobject<BookmarkSyncPromoController> syncPromo( | 37 base::scoped_nsobject<BookmarkSyncPromoController> syncPromo( |
41 [[BookmarkSyncPromoController alloc] initWithBrowser:browser()]); | 38 [[BookmarkSyncPromoController alloc] initWithBrowser:browser()]); |
42 | 39 |
43 // Simulate clicking the "Sign in" link. | 40 // Simulate clicking the "Sign in" link. |
44 [syncPromo textView:nil clickedOnLink:nil atIndex:0u]; | 41 [syncPromo textView:nil clickedOnLink:nil atIndex:0u]; |
45 | 42 |
46 // A new tab should have been opened. | 43 // A new tab should have been opened. |
47 int tab_count = browser()->tab_strip_model()->count(); | 44 int tab_count = browser()->tab_strip_model()->count(); |
48 EXPECT_EQ(starting_tab_count + 1, tab_count); | 45 EXPECT_EQ(starting_tab_count + 1, tab_count); |
49 } | 46 } |
50 | 47 |
51 } // namespace | 48 } // namespace |
OLD | NEW |