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_UI_UI_TEST_H_ | 5 #ifndef CHROME_TEST_UI_UI_TEST_H_ |
6 #define CHROME_TEST_UI_UI_TEST_H_ | 6 #define CHROME_TEST_UI_UI_TEST_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 // This file provides a common base for running UI unit tests, which operate | 9 // This file provides a common base for running UI unit tests, which operate |
10 // the entire browser application in a separate process for holistic | 10 // the entire browser application in a separate process for holistic |
(...skipping 13 matching lines...) Expand all Loading... |
24 #include "base/memory/scoped_ptr.h" | 24 #include "base/memory/scoped_ptr.h" |
25 #include "base/message_loop.h" | 25 #include "base/message_loop.h" |
26 #include "base/process.h" | 26 #include "base/process.h" |
27 #include "base/time.h" | 27 #include "base/time.h" |
28 #include "chrome/test/automation/proxy_launcher.h" | 28 #include "chrome/test/automation/proxy_launcher.h" |
29 #include "googleurl/src/gurl.h" | 29 #include "googleurl/src/gurl.h" |
30 #include "testing/platform_test.h" | 30 #include "testing/platform_test.h" |
31 | 31 |
32 class AutomationProxy; | 32 class AutomationProxy; |
33 class BrowserProxy; | 33 class BrowserProxy; |
34 class DictionaryValue; | |
35 class FilePath; | 34 class FilePath; |
36 class GURL; | 35 class GURL; |
37 class ScopedTempDir; | 36 class ScopedTempDir; |
38 class TabProxy; | 37 class TabProxy; |
39 | 38 |
| 39 namespace base { |
| 40 class DictionaryValue; |
| 41 } |
| 42 |
40 // Base class for UI Tests. This implements the core of the functions. | 43 // Base class for UI Tests. This implements the core of the functions. |
41 // This base class decouples all automation functionality from testing | 44 // This base class decouples all automation functionality from testing |
42 // infrastructure, for use without gtest. | 45 // infrastructure, for use without gtest. |
43 // If using gtest, you probably want to inherit from UITest (declared below) | 46 // If using gtest, you probably want to inherit from UITest (declared below) |
44 // rather than UITestBase. | 47 // rather than UITestBase. |
45 class UITestBase { | 48 class UITestBase { |
46 public: | 49 public: |
47 // Profile theme type choices. | 50 // Profile theme type choices. |
48 enum ProfileType { | 51 enum ProfileType { |
49 DEFAULT_THEME = 0, | 52 DEFAULT_THEME = 0, |
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 virtual void TearDown(); | 372 virtual void TearDown(); |
370 | 373 |
371 virtual ProxyLauncher* CreateProxyLauncher(); | 374 virtual ProxyLauncher* CreateProxyLauncher(); |
372 | 375 |
373 // Count the number of active browser processes launched by this test. | 376 // Count the number of active browser processes launched by this test. |
374 // The count includes browser sub-processes. | 377 // The count includes browser sub-processes. |
375 bool GetBrowserProcessCount(int* count) WARN_UNUSED_RESULT; | 378 bool GetBrowserProcessCount(int* count) WARN_UNUSED_RESULT; |
376 | 379 |
377 // Returns a copy of local state preferences. The caller is responsible for | 380 // Returns a copy of local state preferences. The caller is responsible for |
378 // deleting the returned object. Returns NULL if there is an error. | 381 // deleting the returned object. Returns NULL if there is an error. |
379 DictionaryValue* GetLocalState(); | 382 base::DictionaryValue* GetLocalState(); |
380 | 383 |
381 // Returns a copy of the default profile preferences. The caller is | 384 // Returns a copy of the default profile preferences. The caller is |
382 // responsible for deleting the returned object. Returns NULL if there is an | 385 // responsible for deleting the returned object. Returns NULL if there is an |
383 // error. | 386 // error. |
384 DictionaryValue* GetDefaultProfilePreferences(); | 387 base::DictionaryValue* GetDefaultProfilePreferences(); |
385 | 388 |
386 // Waits for the test case to finish. | 389 // Waits for the test case to finish. |
387 // ASSERTS if there are test failures. | 390 // ASSERTS if there are test failures. |
388 void WaitForFinish(const std::string &name, | 391 void WaitForFinish(const std::string &name, |
389 const std::string &id, const GURL &url, | 392 const std::string &id, const GURL &url, |
390 const std::string& test_complete_cookie, | 393 const std::string& test_complete_cookie, |
391 const std::string& expected_cookie_value, | 394 const std::string& expected_cookie_value, |
392 const int wait_time); | 395 const int wait_time); |
393 | 396 |
394 // Wrapper around EvictFileFromSystemCache to retry 10 times in case of | 397 // Wrapper around EvictFileFromSystemCache to retry 10 times in case of |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
481 #ifdef UNIT_TEST | 484 #ifdef UNIT_TEST |
482 std::ostream& operator<<(std::ostream& out, const std::wstring& wstr); | 485 std::ostream& operator<<(std::ostream& out, const std::wstring& wstr); |
483 | 486 |
484 template<typename T> | 487 template<typename T> |
485 std::ostream& operator<<(std::ostream& out, const ::scoped_ptr<T>& ptr) { | 488 std::ostream& operator<<(std::ostream& out, const ::scoped_ptr<T>& ptr) { |
486 return out << ptr.get(); | 489 return out << ptr.get(); |
487 } | 490 } |
488 #endif // UNIT_TEST | 491 #endif // UNIT_TEST |
489 | 492 |
490 #endif // CHROME_TEST_UI_UI_TEST_H_ | 493 #endif // CHROME_TEST_UI_UI_TEST_H_ |
OLD | NEW |