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

Side by Side Diff: chrome/browser/ui/views/sync/profile_signin_confirmation_dialog_views_browsertest.cc

Issue 2667773003: [reland] MacViews: Allow the toolkit-views Enterprise Signin Confirmation Dialog to be used (Closed)
Patch Set: clearer comment Created 3 years, 10 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/ui/views/sync/profile_signin_confirmation_dialog_views. h"
6
7 #include "base/command_line.h"
8 #include "base/strings/utf_string_conversions.h"
9 #include "chrome/browser/bookmarks/bookmark_model_factory.h"
10 #include "chrome/browser/profiles/profile.h"
11 #include "chrome/browser/ui/browser.h"
12 #include "chrome/browser/ui/sync/profile_signin_confirmation_helper.h"
13 #include "chrome/browser/ui/tab_dialogs.h"
14 #include "chrome/browser/ui/tabs/tab_strip_model.h"
15 #include "chrome/browser/ui/test/test_browser_dialog.h"
16 #include "components/bookmarks/browser/bookmark_model.h"
17 #include "ui/base/ui_base_switches.h"
18
19 namespace {
20
21 // Test delegate passed to the confirmation dialog to receive (and currently
22 // ignore) the result from the dialog.
23 class TestSigninDialogDelegate : public ui::ProfileSigninConfirmationDelegate {
24 public:
25 TestSigninDialogDelegate() {}
26 virtual ~TestSigninDialogDelegate() {}
27
28 void OnCancelSignin() override {}
29 void OnContinueSignin() override {}
30 void OnSigninWithNewProfile() override {}
31
32 private:
33 DISALLOW_COPY_AND_ASSIGN(TestSigninDialogDelegate);
34 };
35
36 } // namespace
37
38 class ProfileSigninConfirmationDialogTest : public DialogBrowserTest {
39 public:
40 ProfileSigninConfirmationDialogTest() {}
41
42 // content::BrowserTestBase:
43 void SetUpCommandLine(base::CommandLine* command_line) override {
44 command_line->AppendSwitch(switches::kExtendMdToSecondaryUi);
45 }
46
47 // DialogBrowserTest:
48 void ShowDialog(const std::string& name) override {
49 Profile* profile = browser()->profile();
50
51 // Add a bookmark to ensure CheckShouldPromptForNewProfile() returns true.
52 bookmarks::BookmarkModel* bookmarks =
53 BookmarkModelFactory::GetForBrowserContext(profile);
54 bookmarks->AddURL(bookmarks->bookmark_bar_node(), 0,
55 base::ASCIIToUTF16("title"),
56 GURL("http://www.example.com"));
57
58 content::WebContents* web_contents =
59 browser()->tab_strip_model()->GetActiveWebContents();
60 TabDialogs::FromWebContents(web_contents)
61 ->ShowProfileSigninConfirmation(
62 browser(), profile, "username@example.com",
63 base::MakeUnique<TestSigninDialogDelegate>());
64 }
65
66 private:
67 DISALLOW_COPY_AND_ASSIGN(ProfileSigninConfirmationDialogTest);
68 };
69
70 // Test that calls ShowDialog("default"). Interactive when run via
71 // browser_tests --gtest_filter=BrowserDialogTest.Invoke --interactive
72 // --dialog=ProfileSigninConfirmationDialogTest.InvokeDialog_default
73 IN_PROC_BROWSER_TEST_F(ProfileSigninConfirmationDialogTest,
74 InvokeDialog_default) {
75 RunDialog();
76 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/sync/profile_signin_confirmation_dialog_views.cc ('k') | chrome/browser/ui/views/tab_dialogs_views.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698