OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #ifndef CHROME_BROWSER_UI_TEST_TEST_BROWSER_DIALOG_H_ | 5 #ifndef CHROME_BROWSER_UI_TEST_TEST_BROWSER_DIALOG_H_ |
6 #define CHROME_BROWSER_UI_TEST_TEST_BROWSER_DIALOG_H_ | 6 #define CHROME_BROWSER_UI_TEST_TEST_BROWSER_DIALOG_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 class TestBrowserDialog { | 57 class TestBrowserDialog { |
58 protected: | 58 protected: |
59 TestBrowserDialog(); | 59 TestBrowserDialog(); |
60 | 60 |
61 // Runs the dialog whose name corresponds to the current test case. | 61 // Runs the dialog whose name corresponds to the current test case. |
62 void RunDialog(); | 62 void RunDialog(); |
63 | 63 |
64 // Show the dialog corresponding to |name| and leave it open. | 64 // Show the dialog corresponding to |name| and leave it open. |
65 virtual void ShowDialog(const std::string& name) = 0; | 65 virtual void ShowDialog(const std::string& name) = 0; |
66 | 66 |
| 67 // Whether to always close asynchronously using Widget::Close(). This covers |
| 68 // codepaths relying on DialogDelegate::Close(), which isn't invoked by |
| 69 // Widget::CloseNow(). Dialogs should support both, since the OS can initiate |
| 70 // the destruction of dialogs, e.g., during logoff which bypass |
| 71 // Widget::CanClose() and DialogDelegate::Close(). |
| 72 virtual bool AlwaysCloseAsynchronously(); |
| 73 |
67 private: | 74 private: |
68 DISALLOW_COPY_AND_ASSIGN(TestBrowserDialog); | 75 DISALLOW_COPY_AND_ASSIGN(TestBrowserDialog); |
69 }; | 76 }; |
70 | 77 |
71 // Helper to mix in a TestBrowserDialog to an existing test harness. |Base| | 78 // Helper to mix in a TestBrowserDialog to an existing test harness. |Base| |
72 // must be a descendant of InProcessBrowserTest. | 79 // must be a descendant of InProcessBrowserTest. |
73 template <class Base> | 80 template <class Base> |
74 class SupportsTestDialog : public Base, public TestBrowserDialog { | 81 class SupportsTestDialog : public Base, public TestBrowserDialog { |
75 protected: | 82 protected: |
76 SupportsTestDialog() {} | 83 SupportsTestDialog() {} |
77 | 84 |
78 private: | 85 private: |
79 DISALLOW_COPY_AND_ASSIGN(SupportsTestDialog); | 86 DISALLOW_COPY_AND_ASSIGN(SupportsTestDialog); |
80 }; | 87 }; |
81 | 88 |
82 using DialogBrowserTest = SupportsTestDialog<InProcessBrowserTest>; | 89 using DialogBrowserTest = SupportsTestDialog<InProcessBrowserTest>; |
83 | 90 |
84 namespace internal { | 91 namespace internal { |
85 | 92 |
86 // When present on the command line, runs the test in an interactive mode. | 93 // When present on the command line, runs the test in an interactive mode. |
87 constexpr const char kInteractiveSwitch[] = "interactive"; | 94 constexpr const char kInteractiveSwitch[] = "interactive"; |
88 | 95 |
89 } // namespace internal | 96 } // namespace internal |
90 | 97 |
91 #endif // CHROME_BROWSER_UI_TEST_TEST_BROWSER_DIALOG_H_ | 98 #endif // CHROME_BROWSER_UI_TEST_TEST_BROWSER_DIALOG_H_ |
OLD | NEW |