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

Side by Side Diff: chrome/browser/policy/logging_work_scheduler_unittest.cc

Issue 8392042: Split BrowserThread into public API and private implementation, step 1. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 9 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "chrome/browser/policy/logging_work_scheduler.h" 5 #include "chrome/browser/policy/logging_work_scheduler.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
11 #include "content/browser/browser_thread.h" 11 #include "content/test/test_browser_thread.h"
12 #include "testing/gtest/include/gtest/gtest.h" 12 #include "testing/gtest/include/gtest/gtest.h"
13 13
14 namespace policy { 14 namespace policy {
15 15
16 class LoggingWorkSchedulerTest : public testing::Test { 16 class LoggingWorkSchedulerTest : public testing::Test {
17 public: 17 public:
18 LoggingWorkSchedulerTest() 18 LoggingWorkSchedulerTest()
19 : ui_thread_(BrowserThread::UI, &loop_) { 19 : ui_thread_(BrowserThread::UI, &loop_) {
20 } 20 }
21 21
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 60
61 // The second scheduler will fire |count2_| events with |delay2_| pauses 61 // The second scheduler will fire |count2_| events with |delay2_| pauses
62 // between each. 62 // between each.
63 scoped_ptr<LoggingWorkScheduler> scheduler2_; 63 scoped_ptr<LoggingWorkScheduler> scheduler2_;
64 int count2_; 64 int count2_;
65 int delay2_; 65 int delay2_;
66 66
67 MessageLoop loop_; 67 MessageLoop loop_;
68 68
69 private: 69 private:
70 BrowserThread ui_thread_; 70 content::TestBrowserThread ui_thread_;
71 71
72 DISALLOW_COPY_AND_ASSIGN(LoggingWorkSchedulerTest); 72 DISALLOW_COPY_AND_ASSIGN(LoggingWorkSchedulerTest);
73 }; 73 };
74 74
75 TEST_F(LoggingWorkSchedulerTest, LoggerTest) { 75 TEST_F(LoggingWorkSchedulerTest, LoggerTest) {
76 logger_.reset(new EventLogger); 76 logger_.reset(new EventLogger);
77 scheduler1_.reset(new LoggingWorkScheduler(logger_.get())); 77 scheduler1_.reset(new LoggingWorkScheduler(logger_.get()));
78 scheduler2_.reset(new LoggingWorkScheduler(logger_.get())); 78 scheduler2_.reset(new LoggingWorkScheduler(logger_.get()));
79 79
80 // Configure the first scheduler to fire at 0, 30, 60, 90, 120. 80 // Configure the first scheduler to fire at 0, 30, 60, 90, 120.
(...skipping 23 matching lines...) Expand all
104 EXPECT_EQ(120, events[8]); 104 EXPECT_EQ(120, events[8]);
105 105
106 EXPECT_EQ(0, EventLogger::CountEvents(events, 0, 0)); 106 EXPECT_EQ(0, EventLogger::CountEvents(events, 0, 0));
107 EXPECT_EQ(2, EventLogger::CountEvents(events, 0, 1)); 107 EXPECT_EQ(2, EventLogger::CountEvents(events, 0, 1));
108 EXPECT_EQ(4, EventLogger::CountEvents(events, 30, 51)); 108 EXPECT_EQ(4, EventLogger::CountEvents(events, 30, 51));
109 EXPECT_EQ(7, EventLogger::CountEvents(events, 0, 120)); 109 EXPECT_EQ(7, EventLogger::CountEvents(events, 0, 120));
110 EXPECT_EQ(7, EventLogger::CountEvents(events, 1, 120)); 110 EXPECT_EQ(7, EventLogger::CountEvents(events, 1, 120));
111 } 111 }
112 112
113 } // namespace policy 113 } // namespace policy
OLDNEW
« no previous file with comments | « chrome/browser/policy/logging_work_scheduler.cc ('k') | chrome/browser/policy/url_blacklist_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698