| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "chrome/test/ui/ui_test.h" | 5 #include "chrome/test/ui/ui_test.h" |
| 6 | 6 |
| 7 #if defined(OS_POSIX) | 7 #if defined(OS_POSIX) |
| 8 #include <signal.h> | 8 #include <signal.h> |
| 9 #include <sys/types.h> | 9 #include <sys/types.h> |
| 10 #endif | 10 #endif |
| 11 | 11 |
| 12 #include <set> | 12 #include <set> |
| 13 #include <vector> | 13 #include <vector> |
| 14 | 14 |
| 15 #include "base/base_switches.h" | 15 #include "base/base_switches.h" |
| 16 #include "base/bind.h" | 16 #include "base/bind.h" |
| 17 #include "base/command_line.h" | 17 #include "base/command_line.h" |
| 18 #include "base/environment.h" | 18 #include "base/environment.h" |
| 19 #include "base/file_path.h" | 19 #include "base/file_path.h" |
| 20 #include "base/file_util.h" | 20 #include "base/file_util.h" |
| 21 #include "base/json/json_file_value_serializer.h" | 21 #include "base/json/json_file_value_serializer.h" |
| 22 #include "base/logging.h" |
| 22 #include "base/memory/scoped_ptr.h" | 23 #include "base/memory/scoped_ptr.h" |
| 23 #include "base/path_service.h" | 24 #include "base/path_service.h" |
| 24 #include "base/process_util.h" | 25 #include "base/process_util.h" |
| 25 #include "base/scoped_temp_dir.h" | 26 #include "base/scoped_temp_dir.h" |
| 26 #include "base/string_number_conversions.h" | 27 #include "base/string_number_conversions.h" |
| 27 #include "base/string_split.h" | 28 #include "base/string_split.h" |
| 28 #include "base/test/test_file_util.h" | 29 #include "base/test/test_file_util.h" |
| 29 #include "base/test/test_timeouts.h" | 30 #include "base/test/test_timeouts.h" |
| 30 #include "base/threading/platform_thread.h" | 31 #include "base/threading/platform_thread.h" |
| 31 #include "base/time.h" | 32 #include "base/time.h" |
| (...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 412 | 413 |
| 413 // static | 414 // static |
| 414 FilePath UITestBase::ComputeTypicalUserDataSource( | 415 FilePath UITestBase::ComputeTypicalUserDataSource( |
| 415 UITestBase::ProfileType profile_type) { | 416 UITestBase::ProfileType profile_type) { |
| 416 FilePath source_history_file; | 417 FilePath source_history_file; |
| 417 EXPECT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, | 418 EXPECT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, |
| 418 &source_history_file)); | 419 &source_history_file)); |
| 419 source_history_file = source_history_file.AppendASCII("profiles"); | 420 source_history_file = source_history_file.AppendASCII("profiles"); |
| 420 switch (profile_type) { | 421 switch (profile_type) { |
| 421 case UITestBase::DEFAULT_THEME: | 422 case UITestBase::DEFAULT_THEME: |
| 422 source_history_file = source_history_file.AppendASCII("typical_history"); | 423 source_history_file = source_history_file.AppendASCII( |
| 424 "profile_with_default_theme"); |
| 423 break; | 425 break; |
| 424 case UITestBase::COMPLEX_THEME: | 426 case UITestBase::COMPLEX_THEME: |
| 425 source_history_file = source_history_file.AppendASCII("complex_theme"); | 427 source_history_file = source_history_file.AppendASCII( |
| 426 break; | 428 "profile_with_complex_theme"); |
| 427 case UITestBase::NATIVE_THEME: | |
| 428 source_history_file = source_history_file.AppendASCII("gtk_theme"); | |
| 429 break; | |
| 430 case UITestBase::CUSTOM_FRAME: | |
| 431 source_history_file = source_history_file.AppendASCII("custom_frame"); | |
| 432 break; | |
| 433 case UITestBase::CUSTOM_FRAME_NATIVE_THEME: | |
| 434 source_history_file = | |
| 435 source_history_file.AppendASCII("custom_frame_gtk_theme"); | |
| 436 break; | 429 break; |
| 437 default: | 430 default: |
| 438 NOTREACHED(); | 431 NOTREACHED(); |
| 439 } | 432 } |
| 433 |
| 434 DCHECK(file_util::PathExists(source_history_file)); |
| 435 |
| 440 return source_history_file; | 436 return source_history_file; |
| 441 } | 437 } |
| 442 | 438 |
| 443 int UITestBase::GetCrashCount() const { | 439 int UITestBase::GetCrashCount() const { |
| 444 FilePath crash_dump_path; | 440 FilePath crash_dump_path; |
| 445 PathService::Get(chrome::DIR_CRASH_DUMPS, &crash_dump_path); | 441 PathService::Get(chrome::DIR_CRASH_DUMPS, &crash_dump_path); |
| 446 int actual_crashes = file_util::CountFilesCreatedAfter( | 442 int actual_crashes = file_util::CountFilesCreatedAfter( |
| 447 crash_dump_path, test_start_time_); | 443 crash_dump_path, test_start_time_); |
| 448 | 444 |
| 449 #if defined(OS_WIN) | 445 #if defined(OS_WIN) |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 715 &session_end_completed)); | 711 &session_end_completed)); |
| 716 ASSERT_TRUE(session_end_completed); | 712 ASSERT_TRUE(session_end_completed); |
| 717 | 713 |
| 718 // Make sure session restore says we didn't crash. | 714 // Make sure session restore says we didn't crash. |
| 719 scoped_ptr<DictionaryValue> profile_prefs(GetDefaultProfilePreferences()); | 715 scoped_ptr<DictionaryValue> profile_prefs(GetDefaultProfilePreferences()); |
| 720 ASSERT_TRUE(profile_prefs.get()); | 716 ASSERT_TRUE(profile_prefs.get()); |
| 721 ASSERT_TRUE(profile_prefs->GetBoolean(prefs::kSessionExitedCleanly, | 717 ASSERT_TRUE(profile_prefs->GetBoolean(prefs::kSessionExitedCleanly, |
| 722 &exited_cleanly)); | 718 &exited_cleanly)); |
| 723 ASSERT_TRUE(exited_cleanly); | 719 ASSERT_TRUE(exited_cleanly); |
| 724 } | 720 } |
| OLD | NEW |