| 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_CHROME_TEST_SUITE_H_ | 5 #ifndef CHROME_TEST_BASE_CHROME_TEST_SUITE_H_ |
| 6 #define CHROME_TEST_BASE_CHROME_TEST_SUITE_H_ | 6 #define CHROME_TEST_BASE_CHROME_TEST_SUITE_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "build/build_config.h" | 11 #include "base/file_path.h" |
| 12 | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/file_util.h" | |
| 14 #include "base/memory/ref_counted.h" | |
| 15 #include "base/path_service.h" | |
| 16 #include "base/test/test_suite.h" | 13 #include "base/test/test_suite.h" |
| 17 #include "chrome/app/scoped_ole_initializer.h" | 14 #include "chrome/app/scoped_ole_initializer.h" |
| 18 #include "chrome/browser/chrome_content_browser_client.h" | |
| 19 #include "chrome/common/chrome_content_client.h" | |
| 20 #include "testing/gtest/include/gtest/gtest.h" | |
| 21 #include "net/base/mock_host_resolver.h" | |
| 22 #include "net/base/net_util.h" | |
| 23 | 15 |
| 24 namespace base { | 16 namespace base { |
| 25 class StatsTable; | 17 class StatsTable; |
| 26 } | 18 } |
| 27 | 19 |
| 28 // In many cases it may be not obvious that a test makes a real DNS lookup. | |
| 29 // We generally don't want to rely on external DNS servers for our tests, | |
| 30 // so this host resolver procedure catches external queries and returns a failed | |
| 31 // lookup result. | |
| 32 class LocalHostResolverProc : public net::HostResolverProc { | |
| 33 public: | |
| 34 LocalHostResolverProc(); | |
| 35 virtual ~LocalHostResolverProc(); | |
| 36 | |
| 37 virtual int Resolve(const std::string& host, | |
| 38 net::AddressFamily address_family, | |
| 39 net::HostResolverFlags host_resolver_flags, | |
| 40 net::AddressList* addrlist, | |
| 41 int* os_error); | |
| 42 }; | |
| 43 | |
| 44 class ChromeTestSuite : public base::TestSuite { | 20 class ChromeTestSuite : public base::TestSuite { |
| 45 public: | 21 public: |
| 46 ChromeTestSuite(int argc, char** argv); | 22 ChromeTestSuite(int argc, char** argv); |
| 47 virtual ~ChromeTestSuite(); | 23 virtual ~ChromeTestSuite(); |
| 48 | 24 |
| 49 protected: | 25 protected: |
| 50 virtual void Initialize(); | 26 virtual void Initialize(); |
| 51 virtual void Shutdown(); | 27 virtual void Shutdown(); |
| 52 | 28 |
| 53 void SetBrowserDirectory(const FilePath& browser_dir) { | 29 void SetBrowserDirectory(const FilePath& browser_dir) { |
| 54 browser_dir_ = browser_dir; | 30 browser_dir_ = browser_dir; |
| 55 } | 31 } |
| 56 | 32 |
| 57 // Client for embedding content in Chrome. | |
| 58 chrome::ChromeContentClient chrome_content_client_; | |
| 59 chrome::ChromeContentBrowserClient chrome_browser_content_client_; | |
| 60 | |
| 61 base::StatsTable* stats_table_; | |
| 62 | |
| 63 // The name used for the stats file so it can be cleaned up on posix during | |
| 64 // test shutdown. | |
| 65 std::string stats_filename_; | |
| 66 | |
| 67 // Alternative path to browser binaries. | 33 // Alternative path to browser binaries. |
| 68 FilePath browser_dir_; | 34 FilePath browser_dir_; |
| 69 | 35 |
| 36 std::string stats_filename_; |
| 37 scoped_ptr<base::StatsTable> stats_table_; |
| 38 |
| 70 ScopedOleInitializer ole_initializer_; | 39 ScopedOleInitializer ole_initializer_; |
| 71 scoped_refptr<LocalHostResolverProc> host_resolver_proc_; | |
| 72 net::ScopedDefaultHostResolverProc scoped_host_resolver_proc_; | |
| 73 }; | 40 }; |
| 74 | 41 |
| 75 #endif // CHROME_TEST_BASE_CHROME_TEST_SUITE_H_ | 42 #endif // CHROME_TEST_BASE_CHROME_TEST_SUITE_H_ |
| OLD | NEW |