| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_TEST_BASE_IN_PROCESS_BROWSER_TEST_H_ | 5 #ifndef CHROME_TEST_BASE_IN_PROCESS_BROWSER_TEST_H_ |
| 6 #define CHROME_TEST_BASE_IN_PROCESS_BROWSER_TEST_H_ | 6 #define CHROME_TEST_BASE_IN_PROCESS_BROWSER_TEST_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/scoped_temp_dir.h" | 12 #include "base/scoped_temp_dir.h" |
| 13 #include "content/public/common/page_transition_types.h" | 13 #include "content/public/common/page_transition_types.h" |
| 14 #include "content/test/browser_test.h" | 14 #include "content/test/browser_test.h" |
| 15 #include "content/test/browser_test_base.h" | 15 #include "content/test/browser_test_base.h" |
| 16 #include "net/test/test_server.h" | 16 #include "net/test/test_server.h" |
| 17 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
| 18 | 18 |
| 19 #if defined(OS_CHROMEOS) | 19 #if defined(OS_CHROMEOS) |
| 20 #include "chrome/browser/chromeos/cros/cros_library.h" | 20 #include "chrome/browser/chromeos/cros/cros_library.h" |
| 21 #endif // defined(OS_CHROMEOS) | 21 #endif // defined(OS_CHROMEOS) |
| 22 | 22 |
| 23 class Browser; | 23 class Browser; |
| 24 class CommandLine; | 24 class CommandLine; |
| 25 class Profile; | 25 class Profile; |
| 26 | 26 |
| 27 namespace content { | 27 namespace content { |
| 28 class ContentRendererClient; | 28 class ContentRendererClient; |
| 29 class ResourceContext; |
| 29 } | 30 } |
| 30 | 31 |
| 31 namespace net { | 32 namespace net { |
| 32 class RuleBasedHostResolverProc; | 33 class RuleBasedHostResolverProc; |
| 33 } | 34 } |
| 34 | 35 |
| 35 // Base class for tests wanting to bring up a browser in the unit test process. | 36 // Base class for tests wanting to bring up a browser in the unit test process. |
| 36 // Writing tests with InProcessBrowserTest is slightly different than that of | 37 // Writing tests with InProcessBrowserTest is slightly different than that of |
| 37 // other tests. This is necessitated by InProcessBrowserTest running a message | 38 // other tests. This is necessitated by InProcessBrowserTest running a message |
| 38 // loop. To use InProcessBrowserTest do the following: | 39 // loop. To use InProcessBrowserTest do the following: |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 // BrowserMain. BrowserMain ends up invoking RunTestOnMainThreadLoop. | 82 // BrowserMain. BrowserMain ends up invoking RunTestOnMainThreadLoop. |
| 82 virtual void SetUp() OVERRIDE; | 83 virtual void SetUp() OVERRIDE; |
| 83 | 84 |
| 84 // Restores state configured in SetUp. | 85 // Restores state configured in SetUp. |
| 85 virtual void TearDown() OVERRIDE; | 86 virtual void TearDown() OVERRIDE; |
| 86 | 87 |
| 87 protected: | 88 protected: |
| 88 // Returns the browser created by CreateBrowser. | 89 // Returns the browser created by CreateBrowser. |
| 89 Browser* browser() const { return browser_; } | 90 Browser* browser() const { return browser_; } |
| 90 | 91 |
| 92 // Returns the ResourceContext from browser_. Needed because tests in content |
| 93 // don't have access to Profile. |
| 94 const content::ResourceContext& GetResourceContext(); |
| 95 |
| 91 // Convenience methods for adding tabs to a Browser. | 96 // Convenience methods for adding tabs to a Browser. |
| 92 void AddTabAtIndexToBrowser(Browser* browser, | 97 void AddTabAtIndexToBrowser(Browser* browser, |
| 93 int index, | 98 int index, |
| 94 const GURL& url, | 99 const GURL& url, |
| 95 content::PageTransition transition); | 100 content::PageTransition transition); |
| 96 void AddTabAtIndex(int index, const GURL& url, | 101 void AddTabAtIndex(int index, const GURL& url, |
| 97 content::PageTransition transition); | 102 content::PageTransition transition); |
| 98 | 103 |
| 99 // Adds a selected tab at |index| to |url| with the specified |transition|. | 104 // Adds a selected tab at |index| to |url| with the specified |transition|. |
| 100 void AddTabAt(int index, const GURL& url, content::PageTransition transition); | 105 void AddTabAt(int index, const GURL& url, content::PageTransition transition); |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 // Temporary user data directory. Used only when a user data directory is not | 198 // Temporary user data directory. Used only when a user data directory is not |
| 194 // specified in the command line. | 199 // specified in the command line. |
| 195 ScopedTempDir temp_user_data_dir_; | 200 ScopedTempDir temp_user_data_dir_; |
| 196 | 201 |
| 197 #if defined(OS_CHROMEOS) | 202 #if defined(OS_CHROMEOS) |
| 198 chromeos::ScopedStubCrosEnabler stub_cros_enabler_; | 203 chromeos::ScopedStubCrosEnabler stub_cros_enabler_; |
| 199 #endif // defined(OS_CHROMEOS) | 204 #endif // defined(OS_CHROMEOS) |
| 200 }; | 205 }; |
| 201 | 206 |
| 202 #endif // CHROME_TEST_BASE_IN_PROCESS_BROWSER_TEST_H_ | 207 #endif // CHROME_TEST_BASE_IN_PROCESS_BROWSER_TEST_H_ |
| OLD | NEW |