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

Side by Side Diff: chrome/test/base/tracing.h

Issue 10837082: implement SetWatchEvent and WaitForEvent for trace-based-tests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cleaned up and fixed a bug Created 8 years, 4 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_TEST_BASE_TRACING_H_ 5 #ifndef CHROME_TEST_BASE_TRACING_H_
6 #define CHROME_TEST_BASE_TRACING_H_ 6 #define CHROME_TEST_BASE_TRACING_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
11 #include "base/time.h"
11 12
12 namespace tracing { 13 namespace tracing {
13 14
14 // Begin tracing specified categories on the browser. 15 // Begin tracing specified categories on the browser.
15 // |categories| is a comma-delimited list of category wildcards. 16 // |categories| is a comma-delimited list of category wildcards.
16 // A category can have an optional '-' prefix to make it an excluded category. 17 // A category can have an optional '-' prefix to make it an excluded category.
17 // Either all categories must be included or all must be excluded. 18 // Either all categories must be included or all must be excluded.
18 // 19 //
19 // Example: BeginTracing("test_MyTest*"); 20 // Example: BeginTracing("test_MyTest*");
20 // Example: BeginTracing("test_MyTest*,test_OtherStuff"); 21 // Example: BeginTracing("test_MyTest*,test_OtherStuff");
21 // Example: BeginTracing("-excluded_category1,-excluded_category2"); 22 // Example: BeginTracing("-excluded_category1,-excluded_category2");
22 // 23 //
23 // See base/debug/trace_event.h for documentation of included and excluded 24 // See base/debug/trace_event.h for documentation of included and excluded
24 // categories. 25 // categories.
25 bool BeginTracing(const std::string& categories) WARN_UNUSED_RESULT; 26 bool BeginTracing(const std::string& categories) WARN_UNUSED_RESULT;
26 27
28 // Specify a watch event in order to use the WaitForWatchEvent function.
29 // After |num_occurrences| of the given event have been seen on a particular
30 // process, WaitForWatchEvent will return.
31 bool BeginTracingWithWatch(const std::string& categories,
32 const char* category_name,
33 const char* event_name,
34 int num_occurrences) WARN_UNUSED_RESULT;
35
36 // Wait on the event set with BeginTracingWithWatch. If non-zero, return after
37 // |timeout| regardless of watch event notification. Returns true if watch event
38 // occurred, false if it timed out.
39 bool WaitForWatchEvent(base::TimeDelta timeout) WARN_UNUSED_RESULT;
40
27 // End trace and collect the trace output as a json string. 41 // End trace and collect the trace output as a json string.
28 bool EndTracing(std::string* json_trace_output) WARN_UNUSED_RESULT; 42 bool EndTracing(std::string* json_trace_output) WARN_UNUSED_RESULT;
29 43
30 } // namespace tracing 44 } // namespace tracing
31 45
32 #endif // CHROME_TEST_BASE_TRACING_H_ 46 #endif // CHROME_TEST_BASE_TRACING_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698