Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(295)

Side by Side Diff: chrome/browser/ui/views/bookmarks/bookmark_bubble_view_browsertest.cc

Issue 2908963002: Use buttons from DialogClientView in BookmakBubbleView. (Closed)
Patch Set: AddPaddingRow Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "chrome/browser/ui/views/bookmarks/bookmark_bubble_view.h" 5 #include "chrome/browser/ui/views/bookmarks/bookmark_bubble_view.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "chrome/browser/bookmarks/bookmark_model_factory.h" 8 #include "chrome/browser/bookmarks/bookmark_model_factory.h"
9 #include "chrome/browser/signin/fake_signin_manager_builder.h" 9 #include "chrome/browser/signin/fake_signin_manager_builder.h"
10 #include "chrome/browser/signin/signin_manager_factory.h" 10 #include "chrome/browser/signin/signin_manager_factory.h"
11 #include "chrome/browser/ui/test/test_browser_dialog.h" 11 #include "chrome/browser/ui/test/test_browser_dialog.h"
12 #include "chrome/browser/ui/views/frame/browser_view.h" 12 #include "chrome/browser/ui/views/frame/browser_view.h"
13 #include "chrome/browser/ui/views/location_bar/star_view.h" 13 #include "chrome/browser/ui/views/location_bar/star_view.h"
14 #include "chrome/browser/ui/views/toolbar/toolbar_view.h" 14 #include "chrome/browser/ui/views/toolbar/toolbar_view.h"
15 #include "chrome/common/chrome_switches.h" 15 #include "chrome/common/chrome_switches.h"
16 #include "chrome/test/base/testing_profile.h" 16 #include "chrome/test/base/testing_profile.h"
17 #include "components/bookmarks/browser/bookmark_model.h" 17 #include "components/bookmarks/browser/bookmark_model.h"
18 #include "components/bookmarks/browser/bookmark_utils.h" 18 #include "components/bookmarks/browser/bookmark_utils.h"
19 #include "components/bookmarks/test/bookmark_test_helpers.h" 19 #include "components/bookmarks/test/bookmark_test_helpers.h"
20 #include "ui/views/window/dialog_client_view.h"
20 21
21 namespace { 22 namespace {
22 23
23 const char kTestBookmarkURL[] = "http://www.google.com"; 24 const char kTestBookmarkURL[] = "http://www.google.com";
24 const char kTestGaiaID[] = "test"; 25 const char kTestGaiaID[] = "test";
25 const char kTestUserEmail[] = "testuser@gtest.com"; 26 const char kTestUserEmail[] = "testuser@gtest.com";
26 27
27 } // namespace 28 } // namespace
28 29
29 class BookmarkBubbleViewBrowserTest : public DialogBrowserTest { 30 class BookmarkBubbleViewBrowserTest : public DialogBrowserTest {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 ->SetAuthenticatedAccountInfo(kTestGaiaID, kTestUserEmail); 62 ->SetAuthenticatedAccountInfo(kTestGaiaID, kTestUserEmail);
62 } 63 }
63 64
64 BrowserView* browser_view = 65 BrowserView* browser_view =
65 BrowserView::GetBrowserViewForBrowser(browser()); 66 BrowserView::GetBrowserViewForBrowser(browser());
66 BookmarkBubbleView::ShowBubble( 67 BookmarkBubbleView::ShowBubble(
67 browser_view->toolbar()->location_bar()->star_view(), gfx::Rect(), 68 browser_view->toolbar()->location_bar()->star_view(), gfx::Rect(),
68 nullptr, nullptr, nullptr, profile_.get(), GURL(kTestBookmarkURL), 69 nullptr, nullptr, nullptr, profile_.get(), GURL(kTestBookmarkURL),
69 true); 70 true);
70 if (name == "ios_promotion") { 71 if (name == "ios_promotion") {
71 BookmarkBubbleView::bookmark_bubble()->HandleButtonPressed( 72 BookmarkBubbleView::bookmark_bubble()
72 BookmarkBubbleView::bookmark_bubble()->save_button_); 73 ->GetWidget()
74 ->client_view()
75 ->AsDialogClientView()
76 ->AcceptWindow();
73 } 77 }
74 } 78 }
75 79
76 private: 80 private:
77 std::unique_ptr<TestingProfile> profile_; 81 std::unique_ptr<TestingProfile> profile_;
78 82
79 DISALLOW_COPY_AND_ASSIGN(BookmarkBubbleViewBrowserTest); 83 DISALLOW_COPY_AND_ASSIGN(BookmarkBubbleViewBrowserTest);
80 }; 84 };
81 85
82 IN_PROC_BROWSER_TEST_F(BookmarkBubbleViewBrowserTest, 86 IN_PROC_BROWSER_TEST_F(BookmarkBubbleViewBrowserTest,
83 InvokeDialog_bookmark_details) { 87 InvokeDialog_bookmark_details) {
84 RunDialog(); 88 RunDialog();
85 } 89 }
86 90
87 IN_PROC_BROWSER_TEST_F(BookmarkBubbleViewBrowserTest, 91 IN_PROC_BROWSER_TEST_F(BookmarkBubbleViewBrowserTest,
88 InvokeDialog_bookmark_details_signed_in) { 92 InvokeDialog_bookmark_details_signed_in) {
89 RunDialog(); 93 RunDialog();
90 } 94 }
91 95
92 #if defined(OS_WIN) 96 #if defined(OS_WIN)
93 IN_PROC_BROWSER_TEST_F(BookmarkBubbleViewBrowserTest, 97 IN_PROC_BROWSER_TEST_F(BookmarkBubbleViewBrowserTest,
94 InvokeDialog_ios_promotion) { 98 InvokeDialog_ios_promotion) {
95 base::CommandLine::ForCurrentProcess()->AppendSwitch( 99 base::CommandLine::ForCurrentProcess()->AppendSwitch(
96 switches::kForceDesktopIOSPromotion); 100 switches::kForceDesktopIOSPromotion);
97 RunDialog(); 101 RunDialog();
98 } 102 }
99 #endif 103 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698