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

Side by Side Diff: third_party/WebKit/Source/platform/WebTaskRunnerTest.cpp

Issue 2723003002: Editing: Fix caret blinking after a typing. (Closed)
Patch Set: Apply review comments Created 3 years, 9 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/WebTaskRunner.h" 5 #include "platform/WebTaskRunner.h"
6 6
7 #include "platform/scheduler/test/fake_web_task_runner.h" 7 #include "platform/scheduler/test/fake_web_task_runner.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 9
10 namespace blink { 10 namespace blink {
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 adoptRef(new scheduler::FakeWebTaskRunner); 122 adoptRef(new scheduler::FakeWebTaskRunner);
123 123
124 int count = 0; 124 int count = 0;
125 TaskHandle handle = taskRunner->postCancellableTask( 125 TaskHandle handle = taskRunner->postCancellableTask(
126 BLINK_FROM_HERE, WTF::bind(&increment, WTF::unretained(&count))); 126 BLINK_FROM_HERE, WTF::bind(&increment, WTF::unretained(&count)));
127 EXPECT_EQ(0, count); 127 EXPECT_EQ(0, count);
128 128
129 // TaskHandle::isActive should detect the deletion of posted task. 129 // TaskHandle::isActive should detect the deletion of posted task.
130 auto queue = taskRunner->takePendingTasksForTesting(); 130 auto queue = taskRunner->takePendingTasksForTesting();
131 ASSERT_EQ(1u, queue.size()); 131 ASSERT_EQ(1u, queue.size());
132 EXPECT_FALSE(queue[0].IsCancelled()); 132 EXPECT_FALSE(queue[0].first.IsCancelled());
133 EXPECT_TRUE(handle.isActive()); 133 EXPECT_TRUE(handle.isActive());
134 queue.clear(); 134 queue.clear();
135 EXPECT_FALSE(handle.isActive()); 135 EXPECT_FALSE(handle.isActive());
136 EXPECT_EQ(0, count); 136 EXPECT_EQ(0, count);
137 137
138 count = 0; 138 count = 0;
139 CancellationTestHelper helper; 139 CancellationTestHelper helper;
140 handle = taskRunner->postCancellableTask( 140 handle = taskRunner->postCancellableTask(
141 BLINK_FROM_HERE, WTF::bind(&CancellationTestHelper::incrementCounter, 141 BLINK_FROM_HERE, WTF::bind(&CancellationTestHelper::incrementCounter,
142 helper.createWeakPtr())); 142 helper.createWeakPtr()));
143 EXPECT_EQ(0, helper.counter()); 143 EXPECT_EQ(0, helper.counter());
144 144
145 // The cancellation of the posted task should be propagated to TaskHandle. 145 // The cancellation of the posted task should be propagated to TaskHandle.
146 queue = taskRunner->takePendingTasksForTesting(); 146 queue = taskRunner->takePendingTasksForTesting();
147 ASSERT_EQ(1u, queue.size()); 147 ASSERT_EQ(1u, queue.size());
148 EXPECT_FALSE(queue[0].IsCancelled()); 148 EXPECT_FALSE(queue[0].first.IsCancelled());
149 EXPECT_TRUE(handle.isActive()); 149 EXPECT_TRUE(handle.isActive());
150 helper.revokeWeakPtrs(); 150 helper.revokeWeakPtrs();
151 EXPECT_TRUE(queue[0].IsCancelled()); 151 EXPECT_TRUE(queue[0].first.IsCancelled());
152 EXPECT_FALSE(handle.isActive()); 152 EXPECT_FALSE(handle.isActive());
153 } 153 }
154 154
155 } // namespace blink 155 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698