| 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 "chrome/browser/ui/views/passwords/manage_passwords_bubble_view.h" | 5 #include "chrome/browser/ui/views/passwords/manage_passwords_bubble_view.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" |
| 7 #include "base/macros.h" | 8 #include "base/macros.h" |
| 8 #include "chrome/browser/ui/passwords/manage_passwords_test.h" | 9 #include "chrome/browser/ui/passwords/manage_passwords_test.h" |
| 9 #include "chrome/browser/ui/test/test_browser_dialog.h" | 10 #include "chrome/browser/ui/test/test_browser_dialog.h" |
| 11 #include "ui/base/ui_base_switches.h" |
| 10 | 12 |
| 11 class ManagePasswordsBubbleDialogViewTest | 13 class ManagePasswordsBubbleDialogViewTest |
| 12 : public SupportsTestDialog<ManagePasswordsTest> { | 14 : public SupportsTestDialog<ManagePasswordsTest> { |
| 13 public: | 15 public: |
| 14 ManagePasswordsBubbleDialogViewTest() {} | 16 ManagePasswordsBubbleDialogViewTest() {} |
| 15 ~ManagePasswordsBubbleDialogViewTest() override {} | 17 ~ManagePasswordsBubbleDialogViewTest() override {} |
| 16 | 18 |
| 17 void ShowDialog(const std::string& name) override { | 19 void ShowDialog(const std::string& name) override { |
| 18 if (name == "PendingPasswordBubble") { | 20 if (name == "PendingPasswordBubble") { |
| 19 SetupPendingPassword(); | 21 SetupPendingPassword(); |
| 20 } else if (name == "AutomaticPasswordBubble") { | 22 } else if (name == "AutomaticPasswordBubble") { |
| 21 SetupAutomaticPassword(); | 23 SetupAutomaticPassword(); |
| 22 } else if (name == "ManagePasswordBubble") { | 24 } else if (name == "ManagePasswordBubble") { |
| 23 SetupManagingPasswords(); | 25 SetupManagingPasswords(); |
| 24 ExecuteManagePasswordsCommand(); | 26 ExecuteManagePasswordsCommand(); |
| 25 } else { | 27 } else { |
| 26 ADD_FAILURE() << "Unknown dialog type"; | 28 ADD_FAILURE() << "Unknown dialog type"; |
| 27 return; | 29 return; |
| 28 } | 30 } |
| 29 } | 31 } |
| 30 | 32 |
| 33 // content::BrowserTestBase: |
| 34 void SetUpCommandLine(base::CommandLine* command_line) override { |
| 35 #if defined(OS_MACOSX) |
| 36 command_line->AppendSwitch(switches::kExtendMdToSecondaryUi); |
| 37 #endif |
| 38 } |
| 39 |
| 31 private: | 40 private: |
| 32 DISALLOW_COPY_AND_ASSIGN(ManagePasswordsBubbleDialogViewTest); | 41 DISALLOW_COPY_AND_ASSIGN(ManagePasswordsBubbleDialogViewTest); |
| 33 }; | 42 }; |
| 34 | 43 |
| 35 IN_PROC_BROWSER_TEST_F(ManagePasswordsBubbleDialogViewTest, | 44 IN_PROC_BROWSER_TEST_F(ManagePasswordsBubbleDialogViewTest, |
| 36 InvokeDialog_PendingPasswordBubble) { | 45 InvokeDialog_PendingPasswordBubble) { |
| 37 RunDialog(); | 46 RunDialog(); |
| 38 } | 47 } |
| 39 | 48 |
| 40 IN_PROC_BROWSER_TEST_F(ManagePasswordsBubbleDialogViewTest, | 49 IN_PROC_BROWSER_TEST_F(ManagePasswordsBubbleDialogViewTest, |
| 41 InvokeDialog_AutomaticPasswordBubble) { | 50 InvokeDialog_AutomaticPasswordBubble) { |
| 42 RunDialog(); | 51 RunDialog(); |
| 43 } | 52 } |
| 44 | 53 |
| 45 IN_PROC_BROWSER_TEST_F(ManagePasswordsBubbleDialogViewTest, | 54 IN_PROC_BROWSER_TEST_F(ManagePasswordsBubbleDialogViewTest, |
| 46 InvokeDialog_ManagePasswordBubble) { | 55 InvokeDialog_ManagePasswordBubble) { |
| 47 RunDialog(); | 56 RunDialog(); |
| 48 } | 57 } |
| OLD | NEW |