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

Unified Diff: content/browser/trace_subscriber_stdio_unittest.cc

Issue 9447003: Revert 123140 - Use SequencedWorkerPool for disk operations in TraceSubscriberStdio. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/trace_subscriber_stdio.cc ('k') | content/common/child_trace_message_filter.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/trace_subscriber_stdio_unittest.cc
===================================================================
--- content/browser/trace_subscriber_stdio_unittest.cc (revision 123143)
+++ content/browser/trace_subscriber_stdio_unittest.cc (working copy)
@@ -1,34 +1,40 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "content/browser/trace_subscriber_stdio.h"
-#include "base/message_loop.h"
#include "base/scoped_temp_dir.h"
-#include "base/threading/sequenced_worker_pool.h"
-#include "content/public/browser/browser_thread.h"
#include "testing/gtest/include/gtest/gtest.h"
-TEST(TraceSubscriberStdioTest, CanWriteDataToFile) {
- ScopedTempDir trace_dir;
- ASSERT_TRUE(trace_dir.CreateUniqueTempDir());
- FilePath trace_file(trace_dir.path().AppendASCII("trace.txt"));
- {
- content::TraceSubscriberStdio subscriber(trace_file);
+namespace {
- std::string foo("foo");
- subscriber.OnTraceDataCollected(
- make_scoped_refptr(base::RefCountedString::TakeString(&foo)));
+class TraceSubscriberStdioTest : public testing::Test {
+ public:
+ virtual void SetUp() {
+ ASSERT_TRUE(trace_dir_.CreateUniqueTempDir());
+ trace_file_ = trace_dir_.path().AppendASCII("trace.txt");
+ }
- std::string bar("bar");
- subscriber.OnTraceDataCollected(
- make_scoped_refptr(base::RefCountedString::TakeString(&bar)));
+ std::string ReadTraceFile() {
+ std::string result;
+ EXPECT_TRUE(file_util::ReadFileToString(trace_file_, &result));
+ return result;
+ }
- subscriber.OnEndTracingComplete();
- }
- content::BrowserThread::GetBlockingPool()->FlushForTesting();
- std::string result;
- EXPECT_TRUE(file_util::ReadFileToString(trace_file, &result));
- EXPECT_EQ("[foo,bar]", result);
+ ScopedTempDir trace_dir_;
+ FilePath trace_file_;
+};
+
+} // namespace
+
+TEST_F(TraceSubscriberStdioTest, CanWriteDataToFile) {
+ TraceSubscriberStdio subscriber(trace_file_);
+ subscriber.OnTraceDataCollected("[foo]");
+ subscriber.OnTraceDataCollected("[bar]");
+ EXPECT_TRUE(subscriber.IsValid());
+
+ subscriber.OnEndTracingComplete();
+ EXPECT_FALSE(subscriber.IsValid());
}
+
« no previous file with comments | « content/browser/trace_subscriber_stdio.cc ('k') | content/common/child_trace_message_filter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698