| 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 #ifndef CHROME_BROWSER_EXTENSIONS_API_RECORD_RECORD_API_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_RECORD_RECORD_API_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_API_RECORD_RECORD_API_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_RECORD_RECORD_API_H_ |
| 7 | 7 |
| 8 #include "chrome/browser/extensions/extension_function.h" | |
| 9 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 10 #include "base/file_path.h" | 9 #include "base/file_path.h" |
| 11 #include "base/time.h" | 10 #include "base/time.h" |
| 11 #include "chrome/browser/extensions/extension_function.h" |
| 12 | 12 |
| 13 namespace { | 13 namespace { |
| 14 | 14 |
| 15 const FilePath::CharType kURLErrorsSuffix[] = FILE_PATH_LITERAL(".errors"); | 15 const FilePath::CharType kURLErrorsSuffix[] = FILE_PATH_LITERAL(".errors"); |
| 16 const char kErrorsKey[] = "errors"; | 16 const char kErrorsKey[] = "errors"; |
| 17 const char kStatsKey[] = "stats"; | 17 const char kStatsKey[] = "stats"; |
| 18 | 18 |
| 19 }; | 19 }; |
| 20 | 20 |
| 21 namespace extensions { | 21 namespace extensions { |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 int repeat_count_; | 98 int repeat_count_; |
| 99 std::vector<std::string> errors_; | 99 std::vector<std::string> errors_; |
| 100 | 100 |
| 101 // Base CommandLine on which to build the test browser CommandLine | 101 // Base CommandLine on which to build the test browser CommandLine |
| 102 CommandLine base_command_line_; | 102 CommandLine base_command_line_; |
| 103 | 103 |
| 104 // ProcessStrategy to use for this run. | 104 // ProcessStrategy to use for this run. |
| 105 scoped_ptr<ProcessStrategy> process_strategy_; | 105 scoped_ptr<ProcessStrategy> process_strategy_; |
| 106 }; | 106 }; |
| 107 | 107 |
| 108 class CaptureURLsFunction : public RunPageCyclerFunction { | 108 class RecordCaptureURLsFunction : public RunPageCyclerFunction { |
| 109 public: | 109 public: |
| 110 DECLARE_EXTENSION_FUNCTION_NAME("experimental.record.captureURLs"); | 110 DECLARE_EXTENSION_FUNCTION_NAME("experimental.record.captureURLs"); |
| 111 | 111 |
| 112 CaptureURLsFunction(); | 112 RecordCaptureURLsFunction(); |
| 113 explicit CaptureURLsFunction(ProcessStrategy* strategy); | 113 explicit RecordCaptureURLsFunction(ProcessStrategy* strategy); |
| 114 | 114 |
| 115 private: | 115 private: |
| 116 virtual ~CaptureURLsFunction() {} | 116 virtual ~RecordCaptureURLsFunction() {} |
| 117 | 117 |
| 118 // Read the ReplayDetails parameter if it exists. | 118 // Read the ReplayDetails parameter if it exists. |
| 119 virtual bool ParseJSParameters() OVERRIDE; | 119 virtual bool ParseJSParameters() OVERRIDE; |
| 120 | 120 |
| 121 // Add record-mode. | 121 // Add record-mode. |
| 122 virtual void AddSwitches(CommandLine* command_line) OVERRIDE; | 122 virtual void AddSwitches(CommandLine* command_line) OVERRIDE; |
| 123 | 123 |
| 124 // Return error list. | 124 // Return error list. |
| 125 virtual void Finish() OVERRIDE; | 125 virtual void Finish() OVERRIDE; |
| 126 }; | 126 }; |
| 127 | 127 |
| 128 class ReplayURLsFunction : public RunPageCyclerFunction { | 128 class RecordReplayURLsFunction : public RunPageCyclerFunction { |
| 129 public: | 129 public: |
| 130 DECLARE_EXTENSION_FUNCTION_NAME("experimental.record.replayURLs"); | 130 DECLARE_EXTENSION_FUNCTION_NAME("experimental.record.replayURLs"); |
| 131 | 131 |
| 132 ReplayURLsFunction(); | 132 RecordReplayURLsFunction(); |
| 133 explicit ReplayURLsFunction(ProcessStrategy* strategy); | 133 explicit RecordReplayURLsFunction(ProcessStrategy* strategy); |
| 134 | 134 |
| 135 private: | 135 private: |
| 136 virtual ~ReplayURLsFunction(); | 136 virtual ~RecordReplayURLsFunction(); |
| 137 | 137 |
| 138 // Read the ReplayDetails parameter if it exists. | 138 // Read the ReplayDetails parameter if it exists. |
| 139 virtual bool ParseJSParameters() OVERRIDE; | 139 virtual bool ParseJSParameters() OVERRIDE; |
| 140 | 140 |
| 141 // Add visit-urls-count and load-extension. | 141 // Add visit-urls-count and load-extension. |
| 142 virtual void AddSwitches(CommandLine* command_line) OVERRIDE; | 142 virtual void AddSwitches(CommandLine* command_line) OVERRIDE; |
| 143 | 143 |
| 144 // Read stats file. | 144 // Read stats file. |
| 145 virtual void ReadReplyFiles() OVERRIDE; | 145 virtual void ReadReplyFiles() OVERRIDE; |
| 146 | 146 |
| 147 // Return error list, statistical results, and runtime. | 147 // Return error list, statistical results, and runtime. |
| 148 virtual void Finish() OVERRIDE; | 148 virtual void Finish() OVERRIDE; |
| 149 | 149 |
| 150 // These data are additional information added to the sub-browser | 150 // These data are additional information added to the sub-browser |
| 151 // commandline or used to repeatedly run the sub-browser. | 151 // commandline or used to repeatedly run the sub-browser. |
| 152 FilePath extension_path_; | 152 FilePath extension_path_; |
| 153 FilePath stats_file_path_; | 153 FilePath stats_file_path_; |
| 154 | 154 |
| 155 // This time datum marks the start and end of the sub-browser run. | 155 // This time datum marks the start and end of the sub-browser run. |
| 156 base::Time timer_; | 156 base::Time timer_; |
| 157 | 157 |
| 158 // These two data are additional information returned to caller. | 158 // These two data are additional information returned to caller. |
| 159 double run_time_ms_; | 159 double run_time_ms_; |
| 160 std::string stats_; | 160 std::string stats_; |
| 161 }; | 161 }; |
| 162 | 162 |
| 163 } // namespace extensions | 163 } // namespace extensions |
| 164 | 164 |
| 165 #endif // CHROME_BROWSER_EXTENSIONS_API_RECORD_RECORD_API_H_ | 165 #endif // CHROME_BROWSER_EXTENSIONS_API_RECORD_RECORD_API_H_ |
| OLD | NEW |