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

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

Issue 9699115: Relax check for message loop in SequencedWorkerPool (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 9 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 "content/browser/trace_subscriber_stdio.h" 5 #include "content/browser/trace_subscriber_stdio.h"
6 6
7 #include "base/message_loop.h"
8 #include "base/scoped_temp_dir.h" 7 #include "base/scoped_temp_dir.h"
9 #include "base/threading/sequenced_worker_pool.h" 8 #include "base/threading/sequenced_worker_pool.h"
10 #include "content/public/browser/browser_thread.h" 9 #include "content/public/browser/browser_thread.h"
11 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
12 11
13 class TraceSubscriberStdioTest : public ::testing::Test { 12 class TraceSubscriberStdioTest : public ::testing::Test {};
14 private:
15 // Needed by the blocking pool (but no need to pump it).
16 MessageLoop message_loop_;
17 };
18 13
19 TEST_F(TraceSubscriberStdioTest, CanWriteDataToFile) { 14 TEST_F(TraceSubscriberStdioTest, CanWriteDataToFile) {
20 ScopedTempDir trace_dir; 15 ScopedTempDir trace_dir;
21 ASSERT_TRUE(trace_dir.CreateUniqueTempDir()); 16 ASSERT_TRUE(trace_dir.CreateUniqueTempDir());
22 FilePath trace_file(trace_dir.path().AppendASCII("trace.txt")); 17 FilePath trace_file(trace_dir.path().AppendASCII("trace.txt"));
23 { 18 {
24 content::TraceSubscriberStdio subscriber(trace_file); 19 content::TraceSubscriberStdio subscriber(trace_file);
25 20
26 std::string foo("foo"); 21 std::string foo("foo");
27 subscriber.OnTraceDataCollected( 22 subscriber.OnTraceDataCollected(
28 make_scoped_refptr(base::RefCountedString::TakeString(&foo))); 23 make_scoped_refptr(base::RefCountedString::TakeString(&foo)));
29 24
30 std::string bar("bar"); 25 std::string bar("bar");
31 subscriber.OnTraceDataCollected( 26 subscriber.OnTraceDataCollected(
32 make_scoped_refptr(base::RefCountedString::TakeString(&bar))); 27 make_scoped_refptr(base::RefCountedString::TakeString(&bar)));
33 28
34 subscriber.OnEndTracingComplete(); 29 subscriber.OnEndTracingComplete();
35 } 30 }
36 content::BrowserThread::GetBlockingPool()->FlushForTesting(); 31 content::BrowserThread::GetBlockingPool()->FlushForTesting();
37 std::string result; 32 std::string result;
38 EXPECT_TRUE(file_util::ReadFileToString(trace_file, &result)); 33 EXPECT_TRUE(file_util::ReadFileToString(trace_file, &result));
39 EXPECT_EQ("[foo,bar]", result); 34 EXPECT_EQ("[foo,bar]", result);
40 } 35 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698