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

Side by Side Diff: third_party/WebKit/Source/platform/threading/BackgroundTaskRunnerTest.cpp

Issue 2547053003: s/ passed(...) / WTF::passed(...) / to avoid future ambiguity w/ base::Passed. (Closed)
Patch Set: Rebasing... Created 4 years 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "platform/threading/BackgroundTaskRunner.h" 5 #include "platform/threading/BackgroundTaskRunner.h"
6 6
7 #include "platform/CrossThreadFunctional.h" 7 #include "platform/CrossThreadFunctional.h"
8 #include "platform/WaitableEvent.h" 8 #include "platform/WaitableEvent.h"
9 #include "public/platform/WebTraceLocation.h" 9 #include "public/platform/WebTraceLocation.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
11 #include "wtf/PtrUtil.h" 11 #include "wtf/PtrUtil.h"
12 #include <memory> 12 #include <memory>
13 13
14 namespace { 14 namespace {
15 15
16 using namespace blink; 16 using namespace blink;
17 17
18 void PingPongTask(WaitableEvent* doneEvent) { 18 void PingPongTask(WaitableEvent* doneEvent) {
19 doneEvent->signal(); 19 doneEvent->signal();
20 } 20 }
21 21
22 class BackgroundTaskRunnerTest : public testing::Test {}; 22 class BackgroundTaskRunnerTest : public testing::Test {};
23 23
24 TEST_F(BackgroundTaskRunnerTest, RunShortTaskOnBackgroundThread) { 24 TEST_F(BackgroundTaskRunnerTest, RunShortTaskOnBackgroundThread) {
25 std::unique_ptr<WaitableEvent> doneEvent = makeUnique<WaitableEvent>(); 25 std::unique_ptr<WaitableEvent> doneEvent = WTF::makeUnique<WaitableEvent>();
26 BackgroundTaskRunner::postOnBackgroundThread( 26 BackgroundTaskRunner::postOnBackgroundThread(
27 BLINK_FROM_HERE, 27 BLINK_FROM_HERE,
28 crossThreadBind(&PingPongTask, crossThreadUnretained(doneEvent.get())), 28 crossThreadBind(&PingPongTask, crossThreadUnretained(doneEvent.get())),
29 BackgroundTaskRunner::TaskSizeShortRunningTask); 29 BackgroundTaskRunner::TaskSizeShortRunningTask);
30 // Test passes by not hanging on the following wait(). 30 // Test passes by not hanging on the following wait().
31 doneEvent->wait(); 31 doneEvent->wait();
32 } 32 }
33 33
34 TEST_F(BackgroundTaskRunnerTest, RunLongTaskOnBackgroundThread) { 34 TEST_F(BackgroundTaskRunnerTest, RunLongTaskOnBackgroundThread) {
35 std::unique_ptr<WaitableEvent> doneEvent = makeUnique<WaitableEvent>(); 35 std::unique_ptr<WaitableEvent> doneEvent = WTF::makeUnique<WaitableEvent>();
36 BackgroundTaskRunner::postOnBackgroundThread( 36 BackgroundTaskRunner::postOnBackgroundThread(
37 BLINK_FROM_HERE, 37 BLINK_FROM_HERE,
38 crossThreadBind(&PingPongTask, crossThreadUnretained(doneEvent.get())), 38 crossThreadBind(&PingPongTask, crossThreadUnretained(doneEvent.get())),
39 BackgroundTaskRunner::TaskSizeLongRunningTask); 39 BackgroundTaskRunner::TaskSizeLongRunningTask);
40 // Test passes by not hanging on the following wait(). 40 // Test passes by not hanging on the following wait().
41 doneEvent->wait(); 41 doneEvent->wait();
42 } 42 }
43 43
44 } // unnamed namespace 44 } // unnamed namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698