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

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

Issue 11273049: Revert 164120 - content/browser: Move more files into the content namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 1 month 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_message_filter.cc ('k') | content/browser/webui/web_ui_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/scoped_temp_dir.h" 7 #include "base/scoped_temp_dir.h"
8 #include "base/threading/sequenced_worker_pool.h" 8 #include "base/threading/sequenced_worker_pool.h"
9 #include "content/public/browser/browser_thread.h" 9 #include "content/public/browser/browser_thread.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
11 11
12 namespace content { 12 class TraceSubscriberStdioTest : public ::testing::Test {};
13 13
14 TEST(TraceSubscriberStdioTest, CanWriteDataToFile) { 14 TEST_F(TraceSubscriberStdioTest, CanWriteDataToFile) {
15 ScopedTempDir trace_dir; 15 ScopedTempDir trace_dir;
16 ASSERT_TRUE(trace_dir.CreateUniqueTempDir()); 16 ASSERT_TRUE(trace_dir.CreateUniqueTempDir());
17 FilePath trace_file(trace_dir.path().AppendASCII("trace.txt")); 17 FilePath trace_file(trace_dir.path().AppendASCII("trace.txt"));
18 { 18 {
19 TraceSubscriberStdio subscriber(trace_file); 19 content::TraceSubscriberStdio subscriber(trace_file);
20 20
21 std::string foo("foo"); 21 std::string foo("foo");
22 subscriber.OnTraceDataCollected( 22 subscriber.OnTraceDataCollected(
23 make_scoped_refptr(base::RefCountedString::TakeString(&foo))); 23 make_scoped_refptr(base::RefCountedString::TakeString(&foo)));
24 24
25 std::string bar("bar"); 25 std::string bar("bar");
26 subscriber.OnTraceDataCollected( 26 subscriber.OnTraceDataCollected(
27 make_scoped_refptr(base::RefCountedString::TakeString(&bar))); 27 make_scoped_refptr(base::RefCountedString::TakeString(&bar)));
28 28
29 subscriber.OnEndTracingComplete(); 29 subscriber.OnEndTracingComplete();
30 } 30 }
31 BrowserThread::GetBlockingPool()->FlushForTesting(); 31 content::BrowserThread::GetBlockingPool()->FlushForTesting();
32 std::string result; 32 std::string result;
33 EXPECT_TRUE(file_util::ReadFileToString(trace_file, &result)); 33 EXPECT_TRUE(file_util::ReadFileToString(trace_file, &result));
34 EXPECT_EQ("[foo,bar]", result); 34 EXPECT_EQ("[foo,bar]", result);
35 } 35 }
36
37 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/trace_message_filter.cc ('k') | content/browser/webui/web_ui_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698