ShellTestBaseAura for AppShell unit tests
ShellTestBaseAura augments extensions::ExtensionsTest and also sets up
the Aura environment. app_shell_unittests test classes can derive from
ShellTestBaseAura to get this set-up for free, instead of deriving from
either ExtensionsTest (which doesn't create a
ShellExtensionsBrowserClient) or AuraTestBase (which sets up its own
Screen and RootWindow).
In particular, deriving ShellDesktopControllerAuraTest from AuraTestBase
doesn't make sense because the ShellDesktopControllerAura creates
its own screen and RootWindow.
This also provides ShellTestHelperAura, which can be used as a class
member to get shell environment set-up without deriving a test from
ExtensionsTest.
Change-Id: I4565c985c77444ebc7325fd7d5295d028f85f774
Reviewed-on: https://chromium-review.googlesource.com/591641
Commit-Queue: Michael Giuffrida <[email protected]>
Reviewed-by: Scott Violet <[email protected]>
Reviewed-by: Ben Wells <[email protected]>
Reviewed-by: Mitsuru Oshima <[email protected]>
Cr-Commit-Position: refs/heads/master@{#491934}
diff --git a/extensions/browser/test_extensions_browser_client.h b/extensions/browser/test_extensions_browser_client.h
index c750a3d..362a1e4 100644
--- a/extensions/browser/test_extensions_browser_client.h
+++ b/extensions/browser/test_extensions_browser_client.h
@@ -27,8 +27,10 @@
// this class should call ExtensionsBrowserClient::Set() with its instance.
class TestExtensionsBrowserClient : public ExtensionsBrowserClient {
public:
- // |main_context| is required and must not be an incognito context.
+ // If provided, |main_context| must not be an incognito context.
explicit TestExtensionsBrowserClient(content::BrowserContext* main_context);
+ // Alternate constructor allowing |main_context_| to be set later.
+ TestExtensionsBrowserClient();
~TestExtensionsBrowserClient() override;
void set_process_manager_delegate(ProcessManagerDelegate* delegate) {
@@ -49,6 +51,10 @@
void SetUpdateClientFactory(
const base::Callback<update_client::UpdateClient*(void)>& factory);
+ // Sets the main browser context. Only call if a BrowserContext was not
+ // already provided. |main_context| must not be an incognito context.
+ void SetMainContext(content::BrowserContext* main_context);
+
// Associates an incognito context with |main_context_|.
void SetIncognitoContext(content::BrowserContext* incognito_context);