OLD | NEW |
1 # Testing Chrome browser dialogs with TestBrowserDialog | 1 # Testing Chrome browser dialogs with TestBrowserDialog |
2 | 2 |
3 \#include "[chrome/browser/ui/test/test_browser_dialog.h]" | 3 \#include "[chrome/browser/ui/test/test_browser_dialog.h]" |
4 | 4 |
5 `TestBrowserDialog` provides a way to register an `InProcessBrowserTest` testing | 5 `TestBrowserDialog` provides a way to register an `InProcessBrowserTest` testing |
6 harness with a framework that invokes Chrome browser dialogs in a consistent | 6 harness with a framework that invokes Chrome browser dialogs in a consistent |
7 way. It optionally provides a way to invoke dialogs "interactively". This allows | 7 way. It optionally provides a way to invoke dialogs "interactively". This allows |
8 screenshots to be generated easily, with the same test data, to assist with UI | 8 screenshots to be generated easily, with the same test data, to assist with UI |
9 review. It also provides a registry of dialogs so they can be systematically | 9 review. It also provides a registry of dialogs so they can be systematically |
10 checked for subtle changes and regressions. | 10 checked for subtle changes and regressions. |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 IN_PROC_BROWSER_TEST_F(FooDialogTest, InvokeDialog_default) { | 42 IN_PROC_BROWSER_TEST_F(FooDialogTest, InvokeDialog_default) { |
43 RunDialog(); | 43 RunDialog(); |
44 } | 44 } |
45 ``` | 45 ``` |
46 | 46 |
47 Notes: | 47 Notes: |
48 | 48 |
49 * The body of the test is always just "`RunDialog();`". | 49 * The body of the test is always just "`RunDialog();`". |
50 * "`default`" is the `std::string` passed to `ShowDialog()` and can be | 50 * "`default`" is the `std::string` passed to `ShowDialog()` and can be |
51 customized. See | 51 customized. See |
52 [Testing additional dialog "styles"](#Testing-additional-dialog-styles_). | 52 [Testing additional dialog "styles"](#Testing-additional-dialog-styles). |
53 * The text before `default` (in this case) must always be "`InvokeDialog_`". | 53 * The text before `default` (in this case) must always be "`InvokeDialog_`". |
54 | 54 |
55 ### Concrete examples | 55 ### Concrete examples |
56 | 56 |
57 * [chrome/browser/ui/ask_google_for_suggestions_dialog_browsertest.cc] | 57 * [chrome/browser/ui/ask_google_for_suggestions_dialog_browsertest.cc] |
58 * [chrome/browser/ui/autofill/card_unmask_prompt_view_browsertest.cc] | 58 * [chrome/browser/ui/autofill/card_unmask_prompt_view_browsertest.cc] |
59 * [chrome/browser/ui/collected_cookies_browsertest.cc] | 59 * [chrome/browser/ui/collected_cookies_browsertest.cc] |
60 * [chrome/browser/ui/update_chrome_dialog_browsertest.cc] | 60 * [chrome/browser/ui/update_chrome_dialog_browsertest.cc] |
61 | 61 |
62 ## Running the tests | 62 ## Running the tests |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 * should remain open until the dialog is dismissed | 270 * should remain open until the dialog is dismissed |
271 */ | 271 */ |
272 ``` | 272 ``` |
273 | 273 |
274 [chrome/browser/ui/test/test_browser_dialog.h]: https://cs.chromium.org/chromium
/src/chrome/browser/ui/test/test_browser_dialog.h | 274 [chrome/browser/ui/test/test_browser_dialog.h]: https://cs.chromium.org/chromium
/src/chrome/browser/ui/test/test_browser_dialog.h |
275 [chrome/browser/ui/autofill/card_unmask_prompt_view_browsertest.cc]: https://cs.
chromium.org/chromium/src/chrome/browser/ui/autofill/card_unmask_prompt_view_bro
wsertest.cc?l=104&q=ShowDialog | 275 [chrome/browser/ui/autofill/card_unmask_prompt_view_browsertest.cc]: https://cs.
chromium.org/chromium/src/chrome/browser/ui/autofill/card_unmask_prompt_view_bro
wsertest.cc?l=104&q=ShowDialog |
276 [chrome/browser/ui/collected_cookies_browsertest.cc]: https://cs.chromium.org/ch
romium/src/chrome/browser/ui/collected_cookies_browsertest.cc?l=26&q=ShowDialog | 276 [chrome/browser/ui/collected_cookies_browsertest.cc]: https://cs.chromium.org/ch
romium/src/chrome/browser/ui/collected_cookies_browsertest.cc?l=26&q=ShowDialog |
277 [chrome/browser/ui/ask_google_for_suggestions_dialog_browsertest.cc]: https://cs
.chromium.org/chromium/src/chrome/browser/ui/ask_google_for_suggestions_dialog_b
rowsertest.cc?l=18&q=ShowDialog | 277 [chrome/browser/ui/ask_google_for_suggestions_dialog_browsertest.cc]: https://cs
.chromium.org/chromium/src/chrome/browser/ui/ask_google_for_suggestions_dialog_b
rowsertest.cc?l=18&q=ShowDialog |
278 [chrome/browser/ui/update_chrome_dialog_browsertest.cc]: https://cs.chromium.org
/chromium/src/chrome/browser/ui/update_chrome_dialog_browsertest.cc?l=15&q=ShowD
ialog | 278 [chrome/browser/ui/update_chrome_dialog_browsertest.cc]: https://cs.chromium.org
/chromium/src/chrome/browser/ui/update_chrome_dialog_browsertest.cc?l=15&q=ShowD
ialog |
279 [ExtensionBrowserTest]: https://cs.chromium.org/chromium/src/chrome/browser/exte
nsions/extension_browsertest.h?q=extensionbrowsertest&l=40 | 279 [ExtensionBrowserTest]: https://cs.chromium.org/chromium/src/chrome/browser/exte
nsions/extension_browsertest.h?q=extensionbrowsertest&l=40 |
OLD | NEW |