Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(222)

Side by Side Diff: chrome/test/ui/ui_test.cc

Issue 14585015: Recommit the generate profile patch (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Load the browser dll manually on Windows. Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/test/ui/ui_test.h ('k') | chrome/tools/profiles/generate_profile.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 UITestBase::UITestBase() 81 UITestBase::UITestBase()
82 : launch_arguments_(CommandLine::NO_PROGRAM), 82 : launch_arguments_(CommandLine::NO_PROGRAM),
83 expected_errors_(0), 83 expected_errors_(0),
84 expected_crashes_(0), 84 expected_crashes_(0),
85 homepage_(chrome::kAboutBlankURL), 85 homepage_(chrome::kAboutBlankURL),
86 wait_for_initial_loads_(true), 86 wait_for_initial_loads_(true),
87 dom_automation_enabled_(false), 87 dom_automation_enabled_(false),
88 show_window_(false), 88 show_window_(false),
89 clear_profile_(true), 89 clear_profile_(true),
90 include_testing_id_(true), 90 include_testing_id_(true),
91 enable_file_cookies_(true), 91 enable_file_cookies_(true) {
92 profile_type_(UITestBase::DEFAULT_THEME) {
93 PathService::Get(chrome::DIR_APP, &browser_directory_); 92 PathService::Get(chrome::DIR_APP, &browser_directory_);
94 PathService::Get(chrome::DIR_TEST_DATA, &test_data_directory_); 93 PathService::Get(chrome::DIR_TEST_DATA, &test_data_directory_);
95 } 94 }
96 95
97 UITestBase::UITestBase(base::MessageLoop::Type msg_loop_type) 96 UITestBase::UITestBase(base::MessageLoop::Type msg_loop_type)
98 : launch_arguments_(CommandLine::NO_PROGRAM), 97 : launch_arguments_(CommandLine::NO_PROGRAM),
99 expected_errors_(0), 98 expected_errors_(0),
100 expected_crashes_(0), 99 expected_crashes_(0),
101 wait_for_initial_loads_(true), 100 wait_for_initial_loads_(true),
102 dom_automation_enabled_(false), 101 dom_automation_enabled_(false),
103 show_window_(false), 102 show_window_(false),
104 clear_profile_(true), 103 clear_profile_(true),
105 include_testing_id_(true), 104 include_testing_id_(true),
106 enable_file_cookies_(true), 105 enable_file_cookies_(true) {
107 profile_type_(UITestBase::DEFAULT_THEME) {
108 PathService::Get(chrome::DIR_APP, &browser_directory_); 106 PathService::Get(chrome::DIR_APP, &browser_directory_);
109 PathService::Get(chrome::DIR_TEST_DATA, &test_data_directory_); 107 PathService::Get(chrome::DIR_TEST_DATA, &test_data_directory_);
110 } 108 }
111 109
112 UITestBase::~UITestBase() {} 110 UITestBase::~UITestBase() {}
113 111
114 void UITestBase::SetUp() { 112 void UITestBase::SetUp() {
115 // Tests that do a session restore (e.g. SessionRestoreUITest, StartupTest) 113 // Tests that do a session restore (e.g. SessionRestoreUITest, StartupTest)
116 // call SetUp() multiple times because they restart the browser mid-test. 114 // call SetUp() multiple times because they restart the browser mid-test.
117 // We don't want to reset the ProxyLauncher's state in those cases. 115 // We don't want to reset the ProxyLauncher's state in those cases.
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 EXPECT_TRUE(launcher_->WaitForBrowserProcessToQuit( 410 EXPECT_TRUE(launcher_->WaitForBrowserProcessToQuit(
413 TestTimeouts::action_max_timeout(), &exit_code)); 411 TestTimeouts::action_max_timeout(), &exit_code));
414 EXPECT_EQ(0, exit_code); // Expect a clean shutown. 412 EXPECT_EQ(0, exit_code); // Expect a clean shutown.
415 // Ensure no child processes are left dangling. 413 // Ensure no child processes are left dangling.
416 TerminateAllChromeProcesses(processes); 414 TerminateAllChromeProcesses(processes);
417 } 415 }
418 416
419 return result; 417 return result;
420 } 418 }
421 419
422 // static
423 base::FilePath UITestBase::ComputeTypicalUserDataSource(
424 UITestBase::ProfileType profile_type) {
425 base::FilePath source_history_file;
426 EXPECT_TRUE(PathService::Get(chrome::DIR_TEST_DATA,
427 &source_history_file));
428 source_history_file = source_history_file.AppendASCII("profiles");
429 switch (profile_type) {
430 case UITestBase::DEFAULT_THEME:
431 source_history_file = source_history_file.AppendASCII(
432 "profile_with_default_theme");
433 break;
434 case UITestBase::COMPLEX_THEME:
435 source_history_file = source_history_file.AppendASCII(
436 "profile_with_complex_theme");
437 break;
438 default:
439 NOTREACHED();
440 }
441
442 return source_history_file;
443 }
444
445 int UITestBase::GetCrashCount() const { 420 int UITestBase::GetCrashCount() const {
446 base::FilePath crash_dump_path; 421 base::FilePath crash_dump_path;
447 PathService::Get(chrome::DIR_CRASH_DUMPS, &crash_dump_path); 422 PathService::Get(chrome::DIR_CRASH_DUMPS, &crash_dump_path);
448 423
449 int files_found = 0; 424 int files_found = 0;
450 file_util::FileEnumerator en(crash_dump_path, false, 425 file_util::FileEnumerator en(crash_dump_path, false,
451 file_util::FileEnumerator::FILES); 426 file_util::FileEnumerator::FILES);
452 while (!en.Next().empty()) { 427 while (!en.Next().empty()) {
453 file_util::FileEnumerator::FindInfo info; 428 file_util::FileEnumerator::FindInfo info;
454 if (file_util::FileEnumerator::GetLastModifiedTime(info) > test_start_time_) 429 if (file_util::FileEnumerator::GetLastModifiedTime(info) > test_start_time_)
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
715 ASSERT_TRUE(session_end_completed); 690 ASSERT_TRUE(session_end_completed);
716 691
717 // Make sure session restore says we didn't crash. 692 // Make sure session restore says we didn't crash.
718 scoped_ptr<DictionaryValue> profile_prefs(GetDefaultProfilePreferences()); 693 scoped_ptr<DictionaryValue> profile_prefs(GetDefaultProfilePreferences());
719 ASSERT_TRUE(profile_prefs.get()); 694 ASSERT_TRUE(profile_prefs.get());
720 std::string exit_type; 695 std::string exit_type;
721 ASSERT_TRUE(profile_prefs->GetString(prefs::kSessionExitedCleanly, 696 ASSERT_TRUE(profile_prefs->GetString(prefs::kSessionExitedCleanly,
722 &exit_type)); 697 &exit_type));
723 EXPECT_EQ(ProfileImpl::kPrefExitTypeNormal, exit_type); 698 EXPECT_EQ(ProfileImpl::kPrefExitTypeNormal, exit_type);
724 } 699 }
OLDNEW
« no previous file with comments | « chrome/test/ui/ui_test.h ('k') | chrome/tools/profiles/generate_profile.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698