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

Side by Side Diff: content/browser/trace_subscriber_stdio_unittest.cc

Issue 7044010: TraceSubscriber implementation that writes to a file. (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 9 years, 7 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
« no previous file with comments | « content/browser/trace_subscriber_stdio.cc ('k') | content/content_browser.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "content/browser/trace_subscriber_stdio.h"
6
7 #include "base/memory/scoped_ptr.h"
Paweł Hajdan Jr. 2011/05/19 16:45:58 nit: Now scoped_ptr doesn't seem to be used, pleas
lain Merrick 2011/05/19 16:51:01 Oops, fixed. I should have done another pass mysel
8 #include "base/memory/scoped_temp_dir.h"
9 #include "testing/gtest/include/gtest/gtest.h"
10
11 namespace {
12
13 class TraceSubscriberStdioTest : public testing::Test {
14 public:
15 virtual void SetUp() {
16 ASSERT_TRUE(trace_dir_.CreateUniqueTempDir());
17 trace_file_ = trace_dir_.path().AppendASCII("trace.txt");
18 }
Paweł Hajdan Jr. 2011/05/19 16:45:58 nit: Add an empty line below.
lain Merrick 2011/05/19 16:51:01 Done.
19 std::string ReadTraceFile() {
20 std::string result;
21 EXPECT_TRUE(file_util::ReadFileToString(trace_file_, &result));
22 return result;
23 }
24
25 ScopedTempDir trace_dir_;
26 FilePath trace_file_;
27 };
28
29 TEST_F(TraceSubscriberStdioTest, CanWriteBracketedDataToFile) {
30 TraceSubscriberStdio subscriber(trace_file_);
31 subscriber.OnTraceDataCollected("[foo]");
32 subscriber.OnTraceDataCollected("[bar]");
33 EXPECT_TRUE(subscriber.IsValid());
34
35 subscriber.OnEndTracingComplete();
36 EXPECT_FALSE(subscriber.IsValid());
37
38 EXPECT_EQ("[foo,bar,]", ReadTraceFile());
39 }
40
41 } // namespace
42
OLDNEW
« no previous file with comments | « content/browser/trace_subscriber_stdio.cc ('k') | content/content_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698