weblayer_browser_test.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. // Copyright 2019 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. #ifndef WEBLAYER_TEST_WEBLAYER_BROWSER_TEST_H_
  5. #define WEBLAYER_TEST_WEBLAYER_BROWSER_TEST_H_
  6. #include "base/memory/raw_ptr.h"
  7. #include "content/public/test/browser_test.h"
  8. #include "content/public/test/browser_test_base.h"
  9. namespace content {
  10. class BrowserContext;
  11. }
  12. namespace weblayer {
  13. class ProfileImpl;
  14. class Shell;
  15. class WebLayerBrowserTest : public content::BrowserTestBase {
  16. public:
  17. WebLayerBrowserTest();
  18. WebLayerBrowserTest(const WebLayerBrowserTest&) = delete;
  19. WebLayerBrowserTest& operator=(const WebLayerBrowserTest&) = delete;
  20. ~WebLayerBrowserTest() override;
  21. // content::BrowserTestBase implementation.
  22. void SetUp() override;
  23. void PreRunTestOnMainThread() override;
  24. void PostRunTestOnMainThread() override;
  25. // Configures this object such that when it starts the shell it does so in
  26. // incognito mode. Must be invoked before SetUp() has been called.
  27. void SetShellStartsInIncognitoMode();
  28. // Returns the window for the test.
  29. Shell* shell() const { return shell_; }
  30. ProfileImpl* GetProfile();
  31. content::BrowserContext* GetBrowserContext();
  32. private:
  33. raw_ptr<Shell> shell_ = nullptr;
  34. bool start_in_incognito_mode_ = false;
  35. };
  36. } // namespace weblayer
  37. #endif // WEBLAYER_TEST_WEBLAYER_BROWSER_TEST_H_