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

Side by Side Diff: base/debug/trace_event_unittest.cc

Issue 13145003: Rewrite std::string("") to std::string(), Linux edition. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Ugh Created 7 years, 8 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 | « no previous file | base/file_util_posix.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 "base/debug/trace_event_unittest.h" 5 #include "base/debug/trace_event_unittest.h"
6 6
7 #include <cstdlib> 7 #include <cstdlib>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 1517 matching lines...) Expand 10 before | Expand all | Expand 10 after
1528 ManualTestSetUp(); 1528 ManualTestSetUp();
1529 1529
1530 TraceLog* trace_log = TraceLog::GetInstance(); 1530 TraceLog* trace_log = TraceLog::GetInstance();
1531 trace_log->SetEnabled(std::string("foo,bar"), TraceLog::RECORD_UNTIL_FULL); 1531 trace_log->SetEnabled(std::string("foo,bar"), TraceLog::RECORD_UNTIL_FULL);
1532 EXPECT_TRUE(*trace_log->GetCategoryEnabled("foo")); 1532 EXPECT_TRUE(*trace_log->GetCategoryEnabled("foo"));
1533 EXPECT_TRUE(*trace_log->GetCategoryEnabled("bar")); 1533 EXPECT_TRUE(*trace_log->GetCategoryEnabled("bar"));
1534 EXPECT_FALSE(*trace_log->GetCategoryEnabled("baz")); 1534 EXPECT_FALSE(*trace_log->GetCategoryEnabled("baz"));
1535 trace_log->SetEnabled(std::string("foo2"), TraceLog::RECORD_UNTIL_FULL); 1535 trace_log->SetEnabled(std::string("foo2"), TraceLog::RECORD_UNTIL_FULL);
1536 EXPECT_TRUE(*trace_log->GetCategoryEnabled("foo2")); 1536 EXPECT_TRUE(*trace_log->GetCategoryEnabled("foo2"));
1537 EXPECT_FALSE(*trace_log->GetCategoryEnabled("baz")); 1537 EXPECT_FALSE(*trace_log->GetCategoryEnabled("baz"));
1538 trace_log->SetEnabled(std::string(""), TraceLog::RECORD_UNTIL_FULL); 1538 trace_log->SetEnabled(std::string(), TraceLog::RECORD_UNTIL_FULL);
1539 EXPECT_TRUE(*trace_log->GetCategoryEnabled("foo")); 1539 EXPECT_TRUE(*trace_log->GetCategoryEnabled("foo"));
1540 EXPECT_TRUE(*trace_log->GetCategoryEnabled("baz")); 1540 EXPECT_TRUE(*trace_log->GetCategoryEnabled("baz"));
1541 trace_log->SetDisabled(); 1541 trace_log->SetDisabled();
1542 trace_log->SetDisabled(); 1542 trace_log->SetDisabled();
1543 trace_log->SetDisabled(); 1543 trace_log->SetDisabled();
1544 EXPECT_FALSE(*trace_log->GetCategoryEnabled("foo")); 1544 EXPECT_FALSE(*trace_log->GetCategoryEnabled("foo"));
1545 EXPECT_FALSE(*trace_log->GetCategoryEnabled("baz")); 1545 EXPECT_FALSE(*trace_log->GetCategoryEnabled("baz"));
1546 1546
1547 trace_log->SetEnabled(std::string("-foo,-bar"), TraceLog::RECORD_UNTIL_FULL); 1547 trace_log->SetEnabled(std::string("-foo,-bar"), TraceLog::RECORD_UNTIL_FULL);
1548 EXPECT_FALSE(*trace_log->GetCategoryEnabled("foo")); 1548 EXPECT_FALSE(*trace_log->GetCategoryEnabled("foo"));
1549 EXPECT_TRUE(*trace_log->GetCategoryEnabled("baz")); 1549 EXPECT_TRUE(*trace_log->GetCategoryEnabled("baz"));
1550 trace_log->SetEnabled(std::string("moo"), TraceLog::RECORD_UNTIL_FULL); 1550 trace_log->SetEnabled(std::string("moo"), TraceLog::RECORD_UNTIL_FULL);
1551 EXPECT_TRUE(*trace_log->GetCategoryEnabled("baz")); 1551 EXPECT_TRUE(*trace_log->GetCategoryEnabled("baz"));
1552 EXPECT_TRUE(*trace_log->GetCategoryEnabled("moo")); 1552 EXPECT_TRUE(*trace_log->GetCategoryEnabled("moo"));
1553 EXPECT_TRUE(*trace_log->GetCategoryEnabled("foo")); 1553 EXPECT_TRUE(*trace_log->GetCategoryEnabled("foo"));
1554 trace_log->SetDisabled(); 1554 trace_log->SetDisabled();
1555 trace_log->SetDisabled(); 1555 trace_log->SetDisabled();
1556 } 1556 }
1557 1557
1558 TEST_F(TraceEventTestFixture, TraceOptionsParsing) { 1558 TEST_F(TraceEventTestFixture, TraceOptionsParsing) {
1559 ManualTestSetUp(); 1559 ManualTestSetUp();
1560 1560
1561 EXPECT_EQ(TraceLog::RECORD_UNTIL_FULL, TraceLog::TraceOptionsFromString("")); 1561 EXPECT_EQ(TraceLog::RECORD_UNTIL_FULL,
1562 TraceLog::TraceOptionsFromString(std::string()));
1562 1563
1563 EXPECT_EQ(TraceLog::RECORD_UNTIL_FULL, 1564 EXPECT_EQ(TraceLog::RECORD_UNTIL_FULL,
1564 TraceLog::TraceOptionsFromString("record-until-full")); 1565 TraceLog::TraceOptionsFromString("record-until-full"));
1565 EXPECT_EQ(TraceLog::RECORD_CONTINUOUSLY, 1566 EXPECT_EQ(TraceLog::RECORD_CONTINUOUSLY,
1566 TraceLog::TraceOptionsFromString("record-continuously")); 1567 TraceLog::TraceOptionsFromString("record-continuously"));
1567 } 1568 }
1568 1569
1569 TEST_F(TraceEventTestFixture, TraceSampling) { 1570 TEST_F(TraceEventTestFixture, TraceSampling) {
1570 ManualTestSetUp(); 1571 ManualTestSetUp();
1571 1572
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
1637 TRACE_EVENT_SCOPE_GLOBAL); 1638 TRACE_EVENT_SCOPE_GLOBAL);
1638 EXPECT_EQ(2u, collected_events_.size()); 1639 EXPECT_EQ(2u, collected_events_.size());
1639 EXPECT_EQ("event1", collected_events_[0]); 1640 EXPECT_EQ("event1", collected_events_[0]);
1640 EXPECT_EQ("event2", collected_events_[1]); 1641 EXPECT_EQ("event2", collected_events_[1]);
1641 } 1642 }
1642 1643
1643 // TODO(dsinclair): Continuous Tracing unit test. 1644 // TODO(dsinclair): Continuous Tracing unit test.
1644 1645
1645 } // namespace debug 1646 } // namespace debug
1646 } // namespace base 1647 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | base/file_util_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698