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

Side by Side Diff: third_party/WebKit/Source/core/dom/MainThreadTaskRunnerTest.cpp

Issue 1686483002: Oilpan: Remove most WillBe types from the code base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 /* 1 /*
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved.
3 * Copyright (C) 2013 Google Inc. All Rights Reserved. 3 * Copyright (C) 2013 Google Inc. All Rights Reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 void performTask(ExecutionContext* context) override 54 void performTask(ExecutionContext* context) override
55 { 55 {
56 *m_toBeMarked = true; 56 *m_toBeMarked = true;
57 } 57 }
58 58
59 bool* m_toBeMarked; 59 bool* m_toBeMarked;
60 }; 60 };
61 61
62 TEST(MainThreadTaskRunnerTest, PostTask) 62 TEST(MainThreadTaskRunnerTest, PostTask)
63 { 63 {
64 RefPtrWillBeRawPtr<NullExecutionContext> context = adoptRefWillBeNoop(new Nu llExecutionContext()); 64 RawPtr<NullExecutionContext> context = (new NullExecutionContext());
65 OwnPtrWillBeRawPtr<MainThreadTaskRunner> runner = MainThreadTaskRunner::crea te(context.get()); 65 RawPtr<MainThreadTaskRunner> runner = MainThreadTaskRunner::create(context.g et());
66 bool isMarked = false; 66 bool isMarked = false;
67 67
68 runner->postTask(BLINK_FROM_HERE, MarkingBooleanTask::create(&isMarked)); 68 runner->postTask(BLINK_FROM_HERE, MarkingBooleanTask::create(&isMarked));
69 EXPECT_FALSE(isMarked); 69 EXPECT_FALSE(isMarked);
70 blink::testing::runPendingTasks(); 70 blink::testing::runPendingTasks();
71 EXPECT_TRUE(isMarked); 71 EXPECT_TRUE(isMarked);
72 } 72 }
73 73
74 TEST(MainThreadTaskRunnerTest, SuspendTask) 74 TEST(MainThreadTaskRunnerTest, SuspendTask)
75 { 75 {
76 RefPtrWillBeRawPtr<NullExecutionContext> context = adoptRefWillBeNoop(new Nu llExecutionContext()); 76 RawPtr<NullExecutionContext> context = (new NullExecutionContext());
77 OwnPtrWillBeRawPtr<MainThreadTaskRunner> runner = MainThreadTaskRunner::crea te(context.get()); 77 RawPtr<MainThreadTaskRunner> runner = MainThreadTaskRunner::create(context.g et());
78 bool isMarked = false; 78 bool isMarked = false;
79 79
80 context->setTasksNeedSuspension(true); 80 context->setTasksNeedSuspension(true);
81 runner->postTask(BLINK_FROM_HERE, MarkingBooleanTask::create(&isMarked)); 81 runner->postTask(BLINK_FROM_HERE, MarkingBooleanTask::create(&isMarked));
82 runner->suspend(); 82 runner->suspend();
83 blink::testing::runPendingTasks(); 83 blink::testing::runPendingTasks();
84 EXPECT_FALSE(isMarked); 84 EXPECT_FALSE(isMarked);
85 85
86 context->setTasksNeedSuspension(false); 86 context->setTasksNeedSuspension(false);
87 runner->resume(); 87 runner->resume();
88 blink::testing::runPendingTasks(); 88 blink::testing::runPendingTasks();
89 EXPECT_TRUE(isMarked); 89 EXPECT_TRUE(isMarked);
90 } 90 }
91 91
92 TEST(MainThreadTaskRunnerTest, RemoveRunner) 92 TEST(MainThreadTaskRunnerTest, RemoveRunner)
93 { 93 {
94 RefPtrWillBeRawPtr<NullExecutionContext> context = adoptRefWillBeNoop(new Nu llExecutionContext()); 94 RawPtr<NullExecutionContext> context = (new NullExecutionContext());
95 OwnPtrWillBeRawPtr<MainThreadTaskRunner> runner = MainThreadTaskRunner::crea te(context.get()); 95 RawPtr<MainThreadTaskRunner> runner = MainThreadTaskRunner::create(context.g et());
96 bool isMarked = false; 96 bool isMarked = false;
97 97
98 context->setTasksNeedSuspension(true); 98 context->setTasksNeedSuspension(true);
99 runner->postTask(BLINK_FROM_HERE, MarkingBooleanTask::create(&isMarked)); 99 runner->postTask(BLINK_FROM_HERE, MarkingBooleanTask::create(&isMarked));
100 runner.clear(); 100 runner.clear();
101 blink::testing::runPendingTasks(); 101 blink::testing::runPendingTasks();
102 EXPECT_FALSE(isMarked); 102 EXPECT_FALSE(isMarked);
103 } 103 }
104 104
105 } // namespace blink 105 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698