OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 "base/threading/thread_restrictions.h" | 5 #include "base/threading/thread_restrictions.h" |
6 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 6 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
7 #include "chrome/browser/signin/fake_signin_manager_builder.h" | 7 #include "chrome/browser/signin/fake_signin_manager_builder.h" |
8 #include "chrome/browser/signin/signin_manager_factory.h" | 8 #include "chrome/browser/signin/signin_manager_factory.h" |
9 #include "chrome/browser/ui/test/test_browser_dialog.h" | 9 #include "chrome/browser/ui/test/test_browser_dialog.h" |
10 #include "chrome/browser/ui/views/bookmarks/bookmark_bubble_view.h" | 10 #include "chrome/browser/ui/views/bookmarks/bookmark_bubble_view.h" |
11 #include "chrome/browser/ui/views/frame/browser_view.h" | 11 #include "chrome/browser/ui/views/frame/browser_view.h" |
12 #include "chrome/browser/ui/views/location_bar/star_view.h" | 12 #include "chrome/browser/ui/views/location_bar/star_view.h" |
13 #include "chrome/browser/ui/views/toolbar/toolbar_view.h" | 13 #include "chrome/browser/ui/views/toolbar/toolbar_view.h" |
14 #include "chrome/test/base/browser_with_test_window_test.h" | 14 #include "chrome/test/base/browser_with_test_window_test.h" |
15 #include "components/bookmarks/browser/bookmark_utils.h" | 15 #include "components/bookmarks/browser/bookmark_utils.h" |
16 #include "components/bookmarks/test/bookmark_test_helpers.h" | 16 #include "components/bookmarks/test/bookmark_test_helpers.h" |
17 | 17 |
| 18 #if defined(OS_WIN) |
| 19 #include "chrome/browser/ui/desktop_ios_promotion/desktop_ios_promotion_util.h" |
| 20 #endif |
| 21 |
18 namespace { | 22 namespace { |
19 | 23 |
20 const char kTestBookmarkURL[] = "http://www.google.com"; | 24 const char kTestBookmarkURL[] = "http://www.google.com"; |
21 const char kTestGaiaID[] = "test"; | 25 const char kTestGaiaID[] = "test"; |
22 const char kTestUserEmail[] = "testuser@gtest.com"; | 26 const char kTestUserEmail[] = "testuser@gtest.com"; |
23 | 27 |
24 } // namespace | 28 } // namespace |
25 | 29 |
26 class BookmarkBubbleViewBrowserTest : public DialogBrowserTest { | 30 class BookmarkBubbleViewBrowserTest : public DialogBrowserTest { |
27 public: | 31 public: |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 nullptr, nullptr, nullptr, profile_.get(), GURL(kTestBookmarkURL), | 68 nullptr, nullptr, nullptr, profile_.get(), GURL(kTestBookmarkURL), |
65 true); | 69 true); |
66 #if defined(OS_WIN) | 70 #if defined(OS_WIN) |
67 } else if ("ios_promotion" == name) { | 71 } else if ("ios_promotion" == name) { |
68 SigninManagerFactory::GetForProfile(profile_.get()) | 72 SigninManagerFactory::GetForProfile(profile_.get()) |
69 ->SetAuthenticatedAccountInfo(kTestGaiaID, kTestUserEmail); | 73 ->SetAuthenticatedAccountInfo(kTestGaiaID, kTestUserEmail); |
70 BookmarkBubbleView::ShowBubble( | 74 BookmarkBubbleView::ShowBubble( |
71 browser_view->toolbar()->location_bar()->star_view(), gfx::Rect(), | 75 browser_view->toolbar()->location_bar()->star_view(), gfx::Rect(), |
72 nullptr, nullptr, nullptr, profile_.get(), GURL(kTestBookmarkURL), | 76 nullptr, nullptr, nullptr, profile_.get(), GURL(kTestBookmarkURL), |
73 true); | 77 true); |
74 BookmarkBubbleView::bookmark_bubble()->ShowIOSPromotion(); | 78 BookmarkBubbleView::bookmark_bubble()->ShowIOSPromotion( |
| 79 desktop_ios_promotion::PromotionEntryPoint::BOOKMARKS_BUBBLE); |
75 #endif | 80 #endif |
76 } | 81 } |
77 } | 82 } |
78 | 83 |
79 private: | 84 private: |
80 std::unique_ptr<TestingProfile> profile_; | 85 std::unique_ptr<TestingProfile> profile_; |
81 DISALLOW_COPY_AND_ASSIGN(BookmarkBubbleViewBrowserTest); | 86 DISALLOW_COPY_AND_ASSIGN(BookmarkBubbleViewBrowserTest); |
82 }; | 87 }; |
83 | 88 |
84 IN_PROC_BROWSER_TEST_F(BookmarkBubbleViewBrowserTest, | 89 IN_PROC_BROWSER_TEST_F(BookmarkBubbleViewBrowserTest, |
85 InvokeDialog_bookmark_details) { | 90 InvokeDialog_bookmark_details) { |
86 base::ThreadRestrictions::ScopedAllowIO allow_io; | 91 base::ThreadRestrictions::ScopedAllowIO allow_io; |
87 RunDialog(); | 92 RunDialog(); |
88 } | 93 } |
89 | 94 |
90 IN_PROC_BROWSER_TEST_F(BookmarkBubbleViewBrowserTest, | 95 IN_PROC_BROWSER_TEST_F(BookmarkBubbleViewBrowserTest, |
91 InvokeDialog_bookmark_details_signed_in) { | 96 InvokeDialog_bookmark_details_signed_in) { |
92 base::ThreadRestrictions::ScopedAllowIO allow_io; | 97 base::ThreadRestrictions::ScopedAllowIO allow_io; |
93 RunDialog(); | 98 RunDialog(); |
94 } | 99 } |
95 | 100 |
96 #if defined(OS_WIN) | 101 #if defined(OS_WIN) |
97 IN_PROC_BROWSER_TEST_F(BookmarkBubbleViewBrowserTest, | 102 IN_PROC_BROWSER_TEST_F(BookmarkBubbleViewBrowserTest, |
98 InvokeDialog_ios_promotion) { | 103 InvokeDialog_ios_promotion) { |
99 base::ThreadRestrictions::ScopedAllowIO allow_io; | 104 base::ThreadRestrictions::ScopedAllowIO allow_io; |
100 RunDialog(); | 105 RunDialog(); |
101 } | 106 } |
102 #endif | 107 #endif |
OLD | NEW |