| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 | 7 |
| 8 // This file provides a common base for running UI unit tests, which operate | 8 // This file provides a common base for running UI unit tests, which operate |
| 9 // the entire browser application in a separate process for holistic | 9 // the entire browser application in a separate process for holistic |
| 10 // functional testing. | 10 // functional testing. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 #include <windows.h> | 23 #include <windows.h> |
| 24 #endif | 24 #endif |
| 25 #include <string> | 25 #include <string> |
| 26 | 26 |
| 27 #include "base/command_line.h" | 27 #include "base/command_line.h" |
| 28 #include "base/message_loop.h" | 28 #include "base/message_loop.h" |
| 29 #include "base/path_service.h" | 29 #include "base/path_service.h" |
| 30 #include "base/process.h" | 30 #include "base/process.h" |
| 31 #include "base/scoped_ptr.h" | 31 #include "base/scoped_ptr.h" |
| 32 #include "base/time.h" | 32 #include "base/time.h" |
| 33 #if defined(OS_WIN) | |
| 34 // TODO(evanm): we should be able to just forward-declare | 33 // TODO(evanm): we should be able to just forward-declare |
| 35 // AutomationProxy here, but many files that #include this one don't | 34 // AutomationProxy here, but many files that #include this one don't |
| 36 // themselves #include automation_proxy.h. | 35 // themselves #include automation_proxy.h. |
| 37 #include "chrome/test/automation/automation_proxy.h" | 36 #include "chrome/test/automation/automation_proxy.h" |
| 38 #endif | |
| 39 #include "testing/gtest/include/gtest/gtest.h" | 37 #include "testing/gtest/include/gtest/gtest.h" |
| 40 | 38 |
| 41 class AutomationProxy; | 39 class AutomationProxy; |
| 42 class BrowserProxy; | 40 class BrowserProxy; |
| 43 class DictionaryValue; | 41 class DictionaryValue; |
| 44 class GURL; | 42 class GURL; |
| 45 class TabProxy; | 43 class TabProxy; |
| 46 | 44 |
| 47 class UITest : public testing::Test { | 45 class UITest : public testing::Test { |
| 48 protected: | 46 protected: |
| (...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 const std::wstring& modifier, | 352 const std::wstring& modifier, |
| 355 const std::wstring& trace, | 353 const std::wstring& trace, |
| 356 const std::wstring& values, | 354 const std::wstring& values, |
| 357 const std::wstring& prefix, | 355 const std::wstring& prefix, |
| 358 const std::wstring& suffix, | 356 const std::wstring& suffix, |
| 359 const std::wstring& units, | 357 const std::wstring& units, |
| 360 bool important); | 358 bool important); |
| 361 | 359 |
| 362 protected: | 360 protected: |
| 363 AutomationProxy* automation() { | 361 AutomationProxy* automation() { |
| 364 #if defined(OS_WIN) | |
| 365 EXPECT_TRUE(server_.get()); | 362 EXPECT_TRUE(server_.get()); |
| 366 return server_.get(); | 363 return server_.get(); |
| 367 #else | |
| 368 // TODO(port): restore when AutomationProxy bits work. | |
| 369 NOTIMPLEMENTED(); | |
| 370 return NULL; | |
| 371 #endif | |
| 372 } | 364 } |
| 373 | 365 |
| 374 // Wait a certain amount of time for all the app processes to exit, | 366 // Wait a certain amount of time for all the app processes to exit, |
| 375 // forcibly killing them if they haven't exited by then. | 367 // forcibly killing them if they haven't exited by then. |
| 376 // It has the side-effect of killing every browser window opened in your | 368 // It has the side-effect of killing every browser window opened in your |
| 377 // session, even those unrelated in the test. | 369 // session, even those unrelated in the test. |
| 378 void CleanupAppProcesses(); | 370 void CleanupAppProcesses(); |
| 379 | 371 |
| 380 // Returns the proxy for the currently active tab, or NULL if there is no | 372 // Returns the proxy for the currently active tab, or NULL if there is no |
| 381 // tab or there was some kind of error. The returned pointer MUST be | 373 // tab or there was some kind of error. The returned pointer MUST be |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 431 // running browser instance. | 423 // running browser instance. |
| 432 static bool dump_histograms_on_exit_; // Include histograms in log on exit. | 424 static bool dump_histograms_on_exit_; // Include histograms in log on exit. |
| 433 static bool enable_dcheck_; // Enable dchecks in release mode. | 425 static bool enable_dcheck_; // Enable dchecks in release mode. |
| 434 static bool silent_dump_on_dcheck_; // Dump process memory on dcheck without | 426 static bool silent_dump_on_dcheck_; // Dump process memory on dcheck without |
| 435 // crashing. | 427 // crashing. |
| 436 static bool disable_breakpad_; // Disable breakpad on the browser. | 428 static bool disable_breakpad_; // Disable breakpad on the browser. |
| 437 static int timeout_ms_; // Timeout in milliseconds to wait | 429 static int timeout_ms_; // Timeout in milliseconds to wait |
| 438 // for an test to finish. | 430 // for an test to finish. |
| 439 static std::wstring js_flags_; // Flags passed to the JS engine. | 431 static std::wstring js_flags_; // Flags passed to the JS engine. |
| 440 static std::wstring log_level_; // Logging level. | 432 static std::wstring log_level_; // Logging level. |
| 441 #if defined(OS_WIN) | 433 |
| 442 // TODO(port): restore me after AutomationProxy works. | |
| 443 scoped_ptr<AutomationProxy> server_; | 434 scoped_ptr<AutomationProxy> server_; |
| 444 #endif | |
| 445 | 435 |
| 446 MessageLoop message_loop_; // Enables PostTask to main thread. | 436 MessageLoop message_loop_; // Enables PostTask to main thread. |
| 447 | 437 |
| 448 int command_execution_timeout_ms_; | 438 int command_execution_timeout_ms_; |
| 449 int action_timeout_ms_; | 439 int action_timeout_ms_; |
| 450 int action_max_timeout_ms_; | 440 int action_max_timeout_ms_; |
| 451 int sleep_timeout_ms_; | 441 int sleep_timeout_ms_; |
| 452 | 442 |
| 453 std::wstring ui_test_name_; | 443 std::wstring ui_test_name_; |
| 454 }; | 444 }; |
| 455 | 445 |
| 456 // These exist only to support the gTest assertion macros, and | 446 // These exist only to support the gTest assertion macros, and |
| 457 // shouldn't be used in normal program code. | 447 // shouldn't be used in normal program code. |
| 458 #ifdef UNIT_TEST | 448 #ifdef UNIT_TEST |
| 459 std::ostream& operator<<(std::ostream& out, const std::wstring& wstr); | 449 std::ostream& operator<<(std::ostream& out, const std::wstring& wstr); |
| 460 | 450 |
| 461 template<typename T> | 451 template<typename T> |
| 462 std::ostream& operator<<(std::ostream& out, const ::scoped_ptr<T>& ptr) { | 452 std::ostream& operator<<(std::ostream& out, const ::scoped_ptr<T>& ptr) { |
| 463 return out << ptr.get(); | 453 return out << ptr.get(); |
| 464 } | 454 } |
| 465 #endif // UNIT_TEST | 455 #endif // UNIT_TEST |
| 466 | 456 |
| 467 #endif // CHROME_TEST_UI_UI_TEST_H_ | 457 #endif // CHROME_TEST_UI_UI_TEST_H_ |
| OLD | NEW |