• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2018 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #include "mojo/public/cpp/base/thread_priority_mojom_traits.h"
6 #include "testing/gtest/include/gtest/gtest.h"
7 
8 namespace mojo_base {
9 namespace thread_priority_unittest {
10 
TEST(ThreadPriorityTest,ThreadPriority)11 TEST(ThreadPriorityTest, ThreadPriority) {
12   static constexpr base::ThreadPriority kTestPriorities[] = {
13       base::ThreadPriority::BACKGROUND, base::ThreadPriority::NORMAL,
14       base::ThreadPriority::DISPLAY, base::ThreadPriority::REALTIME_AUDIO};
15 
16   for (auto priority_in : kTestPriorities) {
17     base::ThreadPriority priority_out;
18 
19     mojo_base::mojom::ThreadPriority serialized_priority =
20         mojo::EnumTraits<mojo_base::mojom::ThreadPriority,
21                          base::ThreadPriority>::ToMojom(priority_in);
22     ASSERT_TRUE(
23         (mojo::EnumTraits<mojo_base::mojom::ThreadPriority,
24                           base::ThreadPriority>::FromMojom(serialized_priority,
25                                                            &priority_out)));
26     EXPECT_EQ(priority_in, priority_out);
27   }
28 }
29 
30 }  // namespace thread_priority_unittest
31 }  // namespace mojo_base