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

Side by Side Diff: components/scheduler/child/task_queue_manager_unittest.cc

Issue 1340343003: scheduler: Implement WebFrameScheduler and WebPageScheduler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased + fixed gn build. Created 5 years, 2 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/scheduler/child/task_queue_manager.h" 5 #include "components/scheduler/child/task_queue_manager.h"
6 6
7 #include "base/location.h" 7 #include "base/location.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "base/single_thread_task_runner.h" 9 #include "base/single_thread_task_runner.h"
10 #include "base/test/simple_test_tick_clock.h" 10 #include "base/test/simple_test_tick_clock.h"
(...skipping 1248 matching lines...) Expand 10 before | Expand all | Expand 10 after
1259 std::vector<int> run_order; 1259 std::vector<int> run_order;
1260 runners_[0]->PostTask( 1260 runners_[0]->PostTask(
1261 FROM_HERE, 1261 FROM_HERE,
1262 base::Bind(&PostTestTasksFromNestedMessageLoop, message_loop_.get(), 1262 base::Bind(&PostTestTasksFromNestedMessageLoop, message_loop_.get(),
1263 runners_[0], runners_[1], base::Unretained(&run_order))); 1263 runners_[0], runners_[1], base::Unretained(&run_order)));
1264 1264
1265 message_loop_->RunUntilIdle(); 1265 message_loop_->RunUntilIdle();
1266 ASSERT_THAT(run_order, ElementsAre(1)); 1266 ASSERT_THAT(run_order, ElementsAre(1));
1267 } 1267 }
1268 1268
1269 namespace {
1270
1271 class MockObserver : public TaskQueueManager::Observer {
1272 public:
1273 MOCK_METHOD1(OnUnregisterTaskQueue,
1274 void(const scoped_refptr<internal::TaskQueueImpl>& queue));
1275 };
1276
1277 } // namespace
1278
1279 TEST_F(TaskQueueManagerTest, OnUnregisterTaskQueue) {
1280 Initialize(0u);
1281
1282 MockObserver observer;
1283 manager_->SetObserver(&observer);
1284
1285 scoped_refptr<internal::TaskQueueImpl> task_queue =
1286 manager_->NewTaskQueue(TaskQueue::Spec("test_queue"));
1287
1288 EXPECT_CALL(observer, OnUnregisterTaskQueue(_)).Times(1);
1289 task_queue->UnregisterTaskQueue();
1290
1291 manager_->SetObserver(nullptr);
1292 }
1293
1269 } // namespace scheduler 1294 } // namespace scheduler
OLDNEW
« no previous file with comments | « components/scheduler/child/task_queue_manager.cc ('k') | components/scheduler/renderer/renderer_scheduler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698