diff options
author | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-22 00:58:58 +0000 |
---|---|---|
committer | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-22 00:58:58 +0000 |
commit | 11c2688a90c8626c77e4855d601d9e7b180e51fc (patch) | |
tree | 81966be2fe14d4a6a489c81029a03a66534ea5e4 /chrome/common/deprecated | |
parent | 5dc6e5c358d5ee756e7fdac33cd257e7b17d94e3 (diff) | |
download | chromium_src-11c2688a90c8626c77e4855d601d9e7b180e51fc.zip chromium_src-11c2688a90c8626c77e4855d601d9e7b180e51fc.tar.gz chromium_src-11c2688a90c8626c77e4855d601d9e7b180e51fc.tar.bz2 |
Convert LOG(INFO) to VLOG(1) - chrome/common/.
This also removes LOG_RESOURCE_REQUESTS and all associated code.
Also remove some "using"s, fix non-const ref (style violation), remove some "else" after "return", and remove some extra {}s.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/3941001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@63462 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/deprecated')
-rw-r--r-- | chrome/common/deprecated/event_sys_unittest.cc | 38 |
1 files changed, 16 insertions, 22 deletions
diff --git a/chrome/common/deprecated/event_sys_unittest.cc b/chrome/common/deprecated/event_sys_unittest.cc index 2c55038..3e7957e 100644 --- a/chrome/common/deprecated/event_sys_unittest.cc +++ b/chrome/common/deprecated/event_sys_unittest.cc @@ -15,12 +15,6 @@ #include "chrome/common/deprecated/event_sys-inl.h" #include "testing/gtest/include/gtest/gtest.h" -using std::endl; -using std::ostream; -using std::string; -using std::stringstream; -using std::vector; - namespace { class Pair; @@ -43,7 +37,7 @@ struct TestEventTraits { class Pair { public: typedef EventChannel<TestEventTraits> Channel; - explicit Pair(const string& name) : name_(name), a_(0), b_(0) { + explicit Pair(const std::string& name) : name_(name), a_(0), b_(0) { TestEvent shutdown = { this, TestEvent::PAIR_BEING_DELETED, 0 }; event_channel_ = new Channel(shutdown); } @@ -62,11 +56,11 @@ class Pair { } int a() const { return a_; } int b() const { return b_; } - const string& name() { return name_; } + const std::string& name() { return name_; } Channel* event_channel() const { return event_channel_; } protected: - const string name_; + const std::string name_; int a_; int b_; Channel* event_channel_; @@ -74,19 +68,19 @@ class Pair { class EventLogger { public: - explicit EventLogger(ostream& out) : out_(out) { } + explicit EventLogger(std::ostream* out) : out_(out) { } ~EventLogger() { for (Hookups::iterator i = hookups_.begin(); i != hookups_.end(); ++i) delete *i; } - void Hookup(const string name, Pair::Channel* channel) { + void Hookup(const std::string name, Pair::Channel* channel) { hookups_.push_back(NewEventListenerHookup(channel, this, &EventLogger::HandlePairEvent, name)); } - void HandlePairEvent(const string& name, const TestEvent& event) { + void HandlePairEvent(const std::string& name, const TestEvent& event) { const char* what_changed = NULL; int new_value = 0; Hookups::iterator dead; @@ -100,21 +94,21 @@ class EventLogger { new_value = event.source->b(); break; case TestEvent::PAIR_BEING_DELETED: - out_ << name << " heard " << event.source->name() << " being deleted." - << endl; + *out_ << name << " heard " << event.source->name() << " being deleted." + << std::endl; return; default: FAIL() << "Bad event.what_happened: " << event.what_happened; break; } - out_ << name << " heard " << event.source->name() << "'s " << what_changed - << " change from " - << event.old_value << " to " << new_value << endl; + *out_ << name << " heard " << event.source->name() << "'s " << what_changed + << " change from " << event.old_value + << " to " << new_value << std::endl; } - typedef vector<EventListenerHookup*> Hookups; + typedef std::vector<EventListenerHookup*> Hookups; Hookups hookups_; - ostream& out_; + std::ostream* out_; }; const char golden_result[] = "Larry heard Sally's B change from 0 to 2\n" @@ -126,8 +120,8 @@ const char golden_result[] = "Larry heard Sally's B change from 0 to 2\n" TEST(EventSys, Basic) { Pair sally("Sally"), sam("Sam"); sally.set_a(1); - stringstream log; - EventLogger logger(log); + std::stringstream log; + EventLogger logger(&log); logger.Hookup("Larry", sally.event_channel()); sally.set_b(2); sally.set_a(3); @@ -236,7 +230,7 @@ class ThreadTester : public EventListener<TestEvent>, bool remove_event_bool_; Lock completed_mutex_; bool completed_; - vector<ThreadInfo> threads_; + std::vector<ThreadInfo> threads_; ThreadArgs args_; }; |