15821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Copyright (c) 2012 The Chromium Authors. All rights reserved.
25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// found in the LICENSE file.
45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
5effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch#ifndef CONTENT_PUBLIC_TEST_CONTENT_BROWSER_TEST_H_
6effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch#define CONTENT_PUBLIC_TEST_CONTENT_BROWSER_TEST_H_
75821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
85821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "base/memory/scoped_ptr.h"
95821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "content/public/test/browser_test.h"
105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "content/public/test/browser_test_base.h"
115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)namespace content {
135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class Shell;
145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class ShellMainDelegate;
155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
16effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch// Base class for browser tests which use content_shell.
175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class ContentBrowserTest : public BrowserTestBase {
185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) protected:
195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  ContentBrowserTest();
205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual ~ContentBrowserTest();
215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // testing::Test:
235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void SetUp() OVERRIDE;
245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void TearDown() OVERRIDE;
255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // BrowserTestBase:
275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void RunTestOnMainThreadLoop() OVERRIDE;
285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) protected:
305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Creates a new window and loads about:blank.
315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  Shell* CreateBrowser();
325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Creates an off-the-record window and loads about:blank.
345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  Shell* CreateOffTheRecordBrowser();
355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Returns the window for the test.
375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  Shell* shell() const { return shell_; }
385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) private:
405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  Shell* shell_;
415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
42d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)  bool setup_called_;
43d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)
4423730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles)#if defined(OS_ANDROID)
4523730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles)  // For all other platforms, this is done automatically when calling into
4623730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles)  // ContentMain. For Android we set things up manually.
4723730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles)  scoped_ptr<ShellMainDelegate> shell_main_delegate_;
4823730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles)#endif
495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)};
505821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
515821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}  // namespace content
525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
53effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch#endif  // CONTENT_PUBLIC_TEST_CONTENT_BROWSER_TEST_H_
54