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/bookmarks/bookmark_bubble_view.h" | 5 #include "chrome/browser/ui/views/bookmarks/bookmark_bubble_view.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
| 8 #include <utility> |
8 | 9 |
9 #include "base/macros.h" | 10 #include "base/macros.h" |
10 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
11 #include "build/build_config.h" | 12 #include "build/build_config.h" |
12 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 13 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
13 #include "chrome/browser/signin/fake_signin_manager_builder.h" | 14 #include "chrome/browser/signin/fake_signin_manager_builder.h" |
14 #include "chrome/browser/signin/signin_manager_factory.h" | 15 #include "chrome/browser/signin/signin_manager_factory.h" |
15 #include "chrome/browser/ui/sync/bubble_sync_promo_delegate.h" | 16 #include "chrome/browser/ui/sync/bubble_sync_promo_delegate.h" |
16 #include "chrome/test/base/browser_with_test_window_test.h" | 17 #include "chrome/test/base/browser_with_test_window_test.h" |
17 #include "components/bookmarks/browser/bookmark_utils.h" | 18 #include "components/bookmarks/browser/bookmark_utils.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 TestingProfile::Builder builder; | 54 TestingProfile::Builder builder; |
54 builder.AddTestingFactory(SigninManagerFactory::GetInstance(), | 55 builder.AddTestingFactory(SigninManagerFactory::GetInstance(), |
55 BuildFakeSigninManagerBase); | 56 BuildFakeSigninManagerBase); |
56 return builder.Build().release(); | 57 return builder.Build().release(); |
57 } | 58 } |
58 | 59 |
59 protected: | 60 protected: |
60 // Creates a bookmark bubble view. | 61 // Creates a bookmark bubble view. |
61 void CreateBubbleView() { | 62 void CreateBubbleView() { |
62 scoped_ptr<BubbleSyncPromoDelegate> delegate; | 63 scoped_ptr<BubbleSyncPromoDelegate> delegate; |
63 bubble_.reset(new BookmarkBubbleView(NULL, | 64 bubble_.reset(new BookmarkBubbleView(NULL, NULL, std::move(delegate), |
64 NULL, | 65 profile(), GURL(kTestBookmarkURL), |
65 delegate.Pass(), | |
66 profile(), | |
67 GURL(kTestBookmarkURL), | |
68 true)); | 66 true)); |
69 } | 67 } |
70 | 68 |
71 void SetUpSigninManager(const std::string& username) { | 69 void SetUpSigninManager(const std::string& username) { |
72 if (username.empty()) | 70 if (username.empty()) |
73 return; | 71 return; |
74 | 72 |
75 SigninManagerBase* signin_manager = static_cast<SigninManagerBase*>( | 73 SigninManagerBase* signin_manager = static_cast<SigninManagerBase*>( |
76 SigninManagerFactory::GetForProfile(profile())); | 74 SigninManagerFactory::GetForProfile(profile())); |
77 ASSERT_TRUE(signin_manager); | 75 ASSERT_TRUE(signin_manager); |
(...skipping 17 matching lines...) Expand all Loading... |
95 // Verifies that the sync promo is displayed for a user that is not signed in. | 93 // Verifies that the sync promo is displayed for a user that is not signed in. |
96 TEST_F(BookmarkBubbleViewTest, SyncPromoNotSignedIn) { | 94 TEST_F(BookmarkBubbleViewTest, SyncPromoNotSignedIn) { |
97 CreateBubbleView(); | 95 CreateBubbleView(); |
98 bubble_->Init(); | 96 bubble_->Init(); |
99 #if defined(OS_CHROMEOS) | 97 #if defined(OS_CHROMEOS) |
100 EXPECT_FALSE(bubble_->sync_promo_view_); | 98 EXPECT_FALSE(bubble_->sync_promo_view_); |
101 #else // !defined(OS_CHROMEOS) | 99 #else // !defined(OS_CHROMEOS) |
102 EXPECT_TRUE(bubble_->sync_promo_view_); | 100 EXPECT_TRUE(bubble_->sync_promo_view_); |
103 #endif | 101 #endif |
104 } | 102 } |
OLD | NEW |