| 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 <fstream> | 5 #include <fstream> |
| 6 #include <string> | 6 #include <string> |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/environment.h" | 10 #include "base/environment.h" |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 result.append(crash_dump.value()); | 252 result.append(crash_dump.value()); |
| 253 result.append(FILE_PATH_LITERAL(" ***\n")); | 253 result.append(FILE_PATH_LITERAL(" ***\n")); |
| 254 printf("%s", result.c_str()); | 254 printf("%s", result.c_str()); |
| 255 LogCrashResult(crash_dump, command_complete); | 255 LogCrashResult(crash_dump, command_complete); |
| 256 EXPECT_TRUE(false) << "Crash detected."; | 256 EXPECT_TRUE(false) << "Crash detected."; |
| 257 } else { | 257 } else { |
| 258 printf("*** No crashes. See result file for more details. ***\n"); | 258 printf("*** No crashes. See result file for more details. ***\n"); |
| 259 LogSuccessResult(); | 259 LogSuccessResult(); |
| 260 } | 260 } |
| 261 | 261 |
| 262 AppendToTestLog(StringPrintf("total_duration_seconds=%f", | 262 AppendToTestLog(base::StringPrintf("total_duration_seconds=%f", |
| 263 CalculateTestDuration(test_start_time_))); | 263 CalculateTestDuration(test_start_time_))); |
| 264 WriteReportToFile(); | 264 WriteReportToFile(); |
| 265 } | 265 } |
| 266 | 266 |
| 267 | 267 |
| 268 void AutomatedUITest::RunAutomatedUITest() { | 268 void AutomatedUITest::RunAutomatedUITest() { |
| 269 InitTestLog(test_start_time_); | 269 InitTestLog(test_start_time_); |
| 270 | 270 |
| 271 ASSERT_TRUE(InitXMLReader()) << "Error initializing XMLReader"; | 271 ASSERT_TRUE(InitXMLReader()) << "Error initializing XMLReader"; |
| 272 xml_writer_.StartWriting(); | 272 xml_writer_.StartWriting(); |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 // If there was a previous crash, just tear down without logging, so | 353 // If there was a previous crash, just tear down without logging, so |
| 354 // that we know what the last command was before we crashed. | 354 // that we know what the last command was before we crashed. |
| 355 CloseBrowserAndServer(); | 355 CloseBrowserAndServer(); |
| 356 } | 356 } |
| 357 | 357 |
| 358 xml_writer_.StartIndenting(); | 358 xml_writer_.StartIndenting(); |
| 359 xml_writer_.EndElement(); // End "Executed" element. | 359 xml_writer_.EndElement(); // End "Executed" element. |
| 360 } | 360 } |
| 361 } | 361 } |
| 362 | 362 |
| 363 AppendToTestLog(StringPrintf("total_duration_seconds=%f", | 363 AppendToTestLog(base::StringPrintf("total_duration_seconds=%f", |
| 364 CalculateTestDuration(test_start_time_))); | 364 CalculateTestDuration(test_start_time_))); |
| 365 | 365 |
| 366 // The test is finished so write our report. | 366 // The test is finished so write our report. |
| 367 WriteReportToFile(); | 367 WriteReportToFile(); |
| 368 } | 368 } |
| 369 | 369 |
| 370 bool AutomatedUITest::DoAction(const std::string& action) { | 370 bool AutomatedUITest::DoAction(const std::string& action) { |
| 371 bool did_complete_action = false; | 371 bool did_complete_action = false; |
| 372 xml_writer_.StartElement(action); | 372 xml_writer_.StartElement(action); |
| 373 if (debug_logging_enabled_) | 373 if (debug_logging_enabled_) |
| (...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 809 } | 809 } |
| 810 } | 810 } |
| 811 | 811 |
| 812 TEST_F(AutomatedUITest, TheOneAndOnlyTest) { | 812 TEST_F(AutomatedUITest, TheOneAndOnlyTest) { |
| 813 const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess(); | 813 const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess(); |
| 814 if (parsed_command_line.HasSwitch(kReproSwitch)) | 814 if (parsed_command_line.HasSwitch(kReproSwitch)) |
| 815 RunReproduction(); | 815 RunReproduction(); |
| 816 else | 816 else |
| 817 RunAutomatedUITest(); | 817 RunAutomatedUITest(); |
| 818 } | 818 } |
| OLD | NEW |