Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(424)

Side by Side Diff: content/test/browser_test_base.h

Issue 8036044: Add (not yet working) content_browsertests target. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 // Copyright (c) 2011 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
5 #ifndef CONTENT_TEST_BROWSER_TEST_BASE_H_
6 #define CONTENT_TEST_BROWSER_TEST_BASE_H_
7 #pragma once
8
9 #include "base/compiler_specific.h"
10 #include "base/memory/ref_counted.h"
11 #include "testing/gtest/include/gtest/gtest.h"
12
13 namespace net {
14 class RuleBasedHostResolverProc;
15 }
16
17 class BrowserTestBase : public testing::Test {
18 public:
19 BrowserTestBase();
20 virtual ~BrowserTestBase();
21
22 // We do this so we can be used in a Task.
23 void AddRef() {}
24 void Release() {}
25 static bool ImplementsThreadSafeReferenceCounting() { return false; }
26
27 // Configures everything for an in process browser test, then invokes
28 // BrowserMain. BrowserMain ends up invoking RunTestOnMainThreadLoop.
29 virtual void SetUp() OVERRIDE;
30
31 // Restores state configured in SetUp.
32 virtual void TearDown() OVERRIDE;
33
34 protected:
35 // We need these special methods because SetUp is the bottom of the stack
36 // that winds up calling your test method, so it is not always an option
37 // to do what you want by overriding it and calling the superclass version.
38 //
39 // Override this for things you would normally override SetUp for. It will be
40 // called before your individual test fixture method is run, but after most
41 // of the overhead initialization has occured.
42 virtual void SetUpInProcessBrowserTestFixture() {}
43
44 // Override this for things you would normally override TearDown for.
45 virtual void TearDownInProcessBrowserTestFixture() {}
46
47 // Override this rather than TestBody.
48 virtual void RunTestOnMainThread() = 0;
49
50 // This is invoked from main after browser_init/browser_main have completed.
51 // This prepares for the test by creating a new browser, runs the test
52 // (RunTestOnMainThread), quits the browsers and returns.
53 virtual void RunTestOnMainThreadLoop() = 0;
54
55 // Returns the host resolver being used for the tests. Subclasses might want
56 // to configure it inside tests.
57 net::RuleBasedHostResolverProc* host_resolver() {
58 return host_resolver_.get();
59 }
60
61 private:
62 void ProxyRunTestOnMainThreadLoop();
63
64 // Host resolver to use during the test.
65 scoped_refptr<net::RuleBasedHostResolverProc> host_resolver_;
66 };
67
68 #endif // CONTENT_TEST_BROWSER_TEST_BASE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698