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

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"
Paweł Hajdan Jr. 2011/05/19 16:26:49 nit: Add an empty line below.
lain Merrick 2011/05/19 16:38:02 Done.
6 #include "base/memory/scoped_ptr.h"
7 #include "base/memory/scoped_temp_dir.h"
8 #include "testing/gtest/include/gtest/gtest.h"
9 #include "testing/platform_test.h"
Paweł Hajdan Jr. 2011/05/19 16:26:49 nit: This doesn't seem to use PlatformTest.
lain Merrick 2011/05/19 16:38:02 Done.
10
11 namespace {
12
13 class TraceSubscriberStdioTest : public testing::Test {
14 public:
15 virtual void SetUp() {
16 trace_dir_.reset(new ScopedTempDir());
17 ASSERT_TRUE(trace_dir_->CreateUniqueTempDir());
18 trace_file_ = trace_dir_->path().AppendASCII("trace.txt");
19 }
20 virtual void TearDown() {
21 trace_dir_.reset();
Paweł Hajdan Jr. 2011/05/19 16:26:49 This shouldn't be needed. Please remove entire Tea
lain Merrick 2011/05/19 16:38:02 Done.
22 }
23 std::string ReadTraceFile() {
24 std::string result;
25 EXPECT_TRUE(file_util::ReadFileToString(trace_file_, &result));
26 return result;
27 }
28
29 scoped_ptr<ScopedTempDir> trace_dir_;
Paweł Hajdan Jr. 2011/05/19 16:26:49 ScopedTempDir shouldn't need a scoped_ptr. ScopedT
lain Merrick 2011/05/19 16:38:02 Done.
30 FilePath trace_file_;
31 };
32
33 TEST_F(TraceSubscriberStdioTest, CanWriteBracketedDataToFile) {
34 TraceSubscriberStdio subscriber(trace_file_);
35 subscriber.OnTraceDataCollected("[foo]");
36 subscriber.OnTraceDataCollected("[bar]");
37 EXPECT_TRUE(subscriber.IsValid());
38
39 subscriber.OnEndTracingComplete();
40 EXPECT_FALSE(subscriber.IsValid());
41
42 EXPECT_EQ("[foo,bar,]", ReadTraceFile());
43 }
44
45 } // namespace
46
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