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

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

Issue 10479018: Add base::RunLoop and update ui_test_utils to use it to reduce flakiness (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: change Quit to QuitNow in places where it makes sense Created 8 years, 6 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) 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/base/tracing.h" 5 #include "chrome/test/base/tracing.h"
6 6
7 #include "base/debug/trace_event.h" 7 #include "base/debug/trace_event.h"
8 #include "base/memory/singleton.h" 8 #include "base/memory/singleton.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "chrome/test/base/ui_test_utils.h" 10 #include "chrome/test/base/ui_test_utils.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 44
45 *json_trace_output = output.json_output; 45 *json_trace_output = output.json_output;
46 return true; 46 return true;
47 } 47 }
48 48
49 private: 49 private:
50 friend struct DefaultSingletonTraits<InProcessTraceController>; 50 friend struct DefaultSingletonTraits<InProcessTraceController>;
51 51
52 // TraceSubscriber 52 // TraceSubscriber
53 virtual void OnEndTracingComplete() OVERRIDE { 53 virtual void OnEndTracingComplete() OVERRIDE {
54 MessageLoopForUI::current()->Quit(); 54 MessageLoopForUI::current()->QuitNow();
55 } 55 }
56 56
57 // TraceSubscriber 57 // TraceSubscriber
58 virtual void OnTraceDataCollected( 58 virtual void OnTraceDataCollected(
59 const scoped_refptr<base::RefCountedString>& trace_fragment) OVERRIDE { 59 const scoped_refptr<base::RefCountedString>& trace_fragment) OVERRIDE {
60 trace_buffer_.AddFragment(trace_fragment->data()); 60 trace_buffer_.AddFragment(trace_fragment->data());
61 } 61 }
62 62
63 // For collecting trace data asynchronously. 63 // For collecting trace data asynchronously.
64 base::debug::TraceResultBuffer trace_buffer_; 64 base::debug::TraceResultBuffer trace_buffer_;
65 65
66 DISALLOW_COPY_AND_ASSIGN(InProcessTraceController); 66 DISALLOW_COPY_AND_ASSIGN(InProcessTraceController);
67 }; 67 };
68 68
69 } // namespace 69 } // namespace
70 70
71 namespace tracing { 71 namespace tracing {
72 72
73 bool BeginTracing(const std::string& categories) { 73 bool BeginTracing(const std::string& categories) {
74 return InProcessTraceController::GetInstance()->BeginTracing(categories); 74 return InProcessTraceController::GetInstance()->BeginTracing(categories);
75 } 75 }
76 76
77 bool EndTracing(std::string* json_trace_output) { 77 bool EndTracing(std::string* json_trace_output) {
78 return InProcessTraceController::GetInstance()->EndTracing(json_trace_output); 78 return InProcessTraceController::GetInstance()->EndTracing(json_trace_output);
79 } 79 }
80 80
81 } // namespace tracing 81 } // namespace tracing
82 82
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698