Index: chrome/test/reliability/page_load_test.cc |
=================================================================== |
--- chrome/test/reliability/page_load_test.cc (revision 150982) |
+++ chrome/test/reliability/page_load_test.cc (working copy) |
@@ -31,6 +31,8 @@ |
// --nopagedown: won't simulate page down key presses after page load. |
// --noclearprofile: do not clear profile dir before firing up each time. |
// --savedebuglog: save Chrome, V8, and test debug log for each page loaded. |
+// --searchdumpsbypid: Look for crash dumps by browser process id. |
+// "crash_dir/pid/" |
#include <fstream> |
#include <vector> |
@@ -65,6 +67,7 @@ |
#include "chrome/test/automation/browser_proxy.h" |
#include "chrome/test/automation/tab_proxy.h" |
#include "chrome/test/automation/window_proxy.h" |
+#include "chrome/test/base/chrome_process_util.h" |
#include "chrome/test/ui/ui_test.h" |
#include "net/base/net_util.h" |
#include "ui/base/keycodes/keyboard_codes.h" |
@@ -89,6 +92,7 @@ |
const char kSaveDebugLogSwitch[] = "savedebuglog"; |
const char kStressOptSwitch[] = "stress-opt"; |
const char kStressDeoptSwitch[] = "stress-deopt"; |
+const char kSearchDumpsByPid[] = "search-dumps-by-pid"; |
const char kDefaultServerUrl[] = "http://urllist.com"; |
std::string g_server_url; |
@@ -123,6 +127,7 @@ |
bool g_stand_alone = false; |
sky
2012/11/02 15:03:04
None of the these are global. They shouldn't have
|
bool g_stress_opt = false; |
bool g_stress_deopt = false; |
+bool g_search_dumps_by_pid = false; |
void ReportHandler(const std::string& str) { |
// Ignore report events. |
@@ -224,12 +229,14 @@ |
} |
} |
- if (parsed_command_line.HasSwitch(kStressOptSwitch)) { |
+ if (parsed_command_line.HasSwitch(kStressOptSwitch)) |
g_stress_opt = true; |
- } |
- if (parsed_command_line.HasSwitch(kStressDeoptSwitch)) { |
+ |
+ if (parsed_command_line.HasSwitch(kStressDeoptSwitch)) |
g_stress_deopt = true; |
- } |
+ |
+ if (parsed_command_line.HasSwitch(kSearchDumpsByPid)) |
+ g_search_dumps_by_pid = true; |
} |
class PageLoadTest : public UITest { |
@@ -323,6 +330,16 @@ |
test_log << "browser_launched_seconds="; |
test_log << (time_now.ToDoubleT() - time_start) << std::endl; |
+ // Create crash dump directory with pid. |
+ if (g_search_dumps_by_pid) { |
+ actual_crash_dumps_dir_path_ = FilePath(crash_dumps_dir_path_); |
+ ChromeProcessList processes = |
+ GetRunningChromeProcesses(browser_process_id()); |
+ if (!processes.empty()) |
+ actual_crash_dumps_dir_path_ = actual_crash_dumps_dir_path_.Append( |
+ base::Int64ToString16(*processes.begin())); |
+ } |
+ |
int result = AUTOMATION_MSG_NAVIGATION_ERROR; |
// This is essentially what NavigateToURL does except we don't fire |
// assertion when page loading fails. We log the result instead. |
@@ -693,7 +710,7 @@ |
} |
bool HasNewCrashDumps() { |
- file_util::FileEnumerator enumerator(crash_dumps_dir_path_, |
+ file_util::FileEnumerator enumerator(actual_crash_dumps_dir_path_, |
false, // not recursive |
file_util::FileEnumerator::FILES); |
for (FilePath path = enumerator.Next(); !path.value().empty(); |
@@ -713,8 +730,7 @@ |
NavigationMetrics* metrics, |
bool delete_dumps) { |
int num_dumps = 0; |
- |
- file_util::FileEnumerator enumerator(crash_dumps_dir_path_, |
+ file_util::FileEnumerator enumerator(actual_crash_dumps_dir_path_, |
false, // not recursive |
file_util::FileEnumerator::FILES); |
for (FilePath path = enumerator.Next(); !path.value().empty(); |
@@ -722,7 +738,7 @@ |
if (path.MatchesExtension(FILE_PATH_LITERAL(".dmp")) && |
!crash_dumps_[path.BaseName()]) { |
crash_dumps_[path.BaseName()] = true; |
- FilePath crash_dump_file_path(crash_dumps_dir_path_); |
+ FilePath crash_dump_file_path(actual_crash_dumps_dir_path_); |
crash_dump_file_path = crash_dump_file_path.Append(path.BaseName()); |
new_crash_dumps.push_back(crash_dump_file_path); |
if (delete_dumps) |
@@ -782,6 +798,9 @@ |
// The pathname of Chrome's crash dumps directory. |
FilePath crash_dumps_dir_path_; |
+ // The actual crash dumps directory that will be used. |
+ FilePath actual_crash_dumps_dir_path_; |
+ |
// The set of all the crash dumps we have seen. Each crash generates a |
// .dmp and a .txt file in the crash dumps directory. We only store the |
// .dmp files in this set. |