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 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 | 324 |
325 // Returns a copy of local state preferences. The caller is responsible for | 325 // Returns a copy of local state preferences. The caller is responsible for |
326 // deleting the returned object. Returns NULL if there is an error. | 326 // deleting the returned object. Returns NULL if there is an error. |
327 DictionaryValue* GetLocalState(); | 327 DictionaryValue* GetLocalState(); |
328 | 328 |
329 // Returns a copy of the default profile preferences. The caller is | 329 // Returns a copy of the default profile preferences. The caller is |
330 // responsible for deleting the returned object. Returns NULL if there is an | 330 // responsible for deleting the returned object. Returns NULL if there is an |
331 // error. | 331 // error. |
332 DictionaryValue* GetDefaultProfilePreferences(); | 332 DictionaryValue* GetDefaultProfilePreferences(); |
333 | 333 |
| 334 // Generate the file path for testing a particular test. |
| 335 // The file for the tests is all located in |
| 336 // test_root_directory\test_directory\<testcase> |
| 337 static std::wstring GetTestFilePath(const std::wstring& test_directory, |
| 338 const std::wstring &test_case); |
| 339 |
334 // Generate the URL for testing a particular test. | 340 // Generate the URL for testing a particular test. |
335 // HTML for the tests is all located in | 341 // HTML for the tests is all located in |
336 // test_root_directory\test_directory\<testcase> | 342 // test_root_directory\test_directory\<testcase> |
337 static GURL GetTestUrl(const std::wstring& test_directory, | 343 static GURL GetTestUrl(const std::wstring& test_directory, |
338 const std::wstring &test_case); | 344 const std::wstring &test_case); |
339 | 345 |
340 // Waits for the test case to finish. | 346 // Waits for the test case to finish. |
341 // ASSERTS if there are test failures. | 347 // ASSERTS if there are test failures. |
342 void WaitForFinish(const std::string &name, | 348 void WaitForFinish(const std::string &name, |
343 const std::string &id, const GURL &url, | 349 const std::string &id, const GURL &url, |
344 const std::string& test_complete_cookie, | 350 const std::string& test_complete_cookie, |
345 const std::string& expected_cookie_value, | 351 const std::string& expected_cookie_value, |
346 const int wait_time); | 352 const int wait_time); |
| 353 |
| 354 // Waits for a generated file ready, then check it with the original file |
| 355 // to see whether they are equal or not. Also this function will delete the |
| 356 // generated file if the input parameter |delete_generate_file| is true. |
| 357 void WaitForGeneratedFileAndCheck(const std::wstring& generated_file, |
| 358 const std::wstring& original_file, |
| 359 bool need_equal, |
| 360 bool delete_generate_file); |
| 361 |
347 private: | 362 private: |
348 // Check that no processes related to Chrome exist, displaying | 363 // Check that no processes related to Chrome exist, displaying |
349 // the given message if any do. | 364 // the given message if any do. |
350 void AssertAppNotRunning(const std::wstring& error_message); | 365 void AssertAppNotRunning(const std::wstring& error_message); |
351 | 366 |
352 // Common functionality for the public PrintResults methods. | 367 // Common functionality for the public PrintResults methods. |
353 void PrintResultsImpl(const std::wstring& measurement, | 368 void PrintResultsImpl(const std::wstring& measurement, |
354 const std::wstring& modifier, | 369 const std::wstring& modifier, |
355 const std::wstring& trace, | 370 const std::wstring& trace, |
356 const std::wstring& values, | 371 const std::wstring& values, |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
458 #ifdef UNIT_TEST | 473 #ifdef UNIT_TEST |
459 std::ostream& operator<<(std::ostream& out, const std::wstring& wstr); | 474 std::ostream& operator<<(std::ostream& out, const std::wstring& wstr); |
460 | 475 |
461 template<typename T> | 476 template<typename T> |
462 std::ostream& operator<<(std::ostream& out, const ::scoped_ptr<T>& ptr) { | 477 std::ostream& operator<<(std::ostream& out, const ::scoped_ptr<T>& ptr) { |
463 return out << ptr.get(); | 478 return out << ptr.get(); |
464 } | 479 } |
465 #endif // UNIT_TEST | 480 #endif // UNIT_TEST |
466 | 481 |
467 #endif // CHROME_TEST_UI_UI_TEST_H_ | 482 #endif // CHROME_TEST_UI_UI_TEST_H_ |
OLD | NEW |