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

Unified Diff: base/task_scheduler/task_traits_unittest.cc

Issue 2541353003: TaskScheduler: Initialize TaskTraits with the priority of the current thread. (Closed)
Patch Set: improve comment 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/task_scheduler/task_traits.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/task_scheduler/task_traits_unittest.cc
diff --git a/base/task_scheduler/task_traits_unittest.cc b/base/task_scheduler/task_traits_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..fed3f9963e8c56e1c88acf3257cf5d18fc1db1a1
--- /dev/null
+++ b/base/task_scheduler/task_traits_unittest.cc
@@ -0,0 +1,32 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "base/task_scheduler/task_traits.h"
+
+#include "base/task_scheduler/scoped_set_task_priority_for_current_thread.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace base {
+
+// Verify that TaskTraits is initialized with the priority of the task running
+// on the current thread.
+TEST(TaskSchedulerTaskTraitsTest, DefaultPriority) {
+ {
+ internal::ScopedSetTaskPriorityForCurrentThread scope(
+ TaskPriority::BACKGROUND);
+ EXPECT_EQ(TaskPriority::BACKGROUND, TaskTraits().priority());
+ }
+ {
+ internal::ScopedSetTaskPriorityForCurrentThread scope(
+ TaskPriority::USER_VISIBLE);
+ EXPECT_EQ(TaskPriority::USER_VISIBLE, TaskTraits().priority());
+ }
+ {
+ internal::ScopedSetTaskPriorityForCurrentThread scope(
+ TaskPriority::USER_BLOCKING);
+ EXPECT_EQ(TaskPriority::USER_BLOCKING, TaskTraits().priority());
+ }
+}
+
+} // namespace base
« no previous file with comments | « base/task_scheduler/task_traits.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698