OLD | NEW |
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 <stddef.h> | 5 #include <stddef.h> |
6 | 6 |
7 #include <new> | 7 #include <new> |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/metrics/field_trial.h" | 12 #include "base/metrics/field_trial.h" |
| 13 #include "base/strings/string_piece.h" |
13 #include "base/strings/string_util.h" | 14 #include "base/strings/string_util.h" |
14 #include "base/test/histogram_tester.h" | 15 #include "base/test/histogram_tester.h" |
15 #include "base/test/scoped_feature_list.h" | 16 #include "base/test/scoped_feature_list.h" |
16 #include "base/test/test_simple_task_runner.h" | 17 #include "base/test/test_simple_task_runner.h" |
17 #include "build/build_config.h" | 18 #include "build/build_config.h" |
18 #include "content/common/input/synthetic_web_input_event_builders.h" | 19 #include "content/common/input/synthetic_web_input_event_builders.h" |
19 #include "content/renderer/input/main_thread_event_queue.h" | 20 #include "content/renderer/input/main_thread_event_queue.h" |
20 #include "content/renderer/render_thread_impl.h" | 21 #include "content/renderer/render_thread_impl.h" |
21 #include "testing/gtest/include/gtest/gtest.h" | 22 #include "testing/gtest/include/gtest/gtest.h" |
22 #include "third_party/WebKit/public/platform/scheduler/test/mock_renderer_schedu
ler.h" | 23 #include "third_party/WebKit/public/platform/scheduler/test/mock_renderer_schedu
ler.h" |
(...skipping 28 matching lines...) Expand all Loading... |
51 | 52 |
52 } // namespace | 53 } // namespace |
53 | 54 |
54 class MainThreadEventQueueTest : public testing::TestWithParam<unsigned>, | 55 class MainThreadEventQueueTest : public testing::TestWithParam<unsigned>, |
55 public MainThreadEventQueueClient { | 56 public MainThreadEventQueueClient { |
56 public: | 57 public: |
57 MainThreadEventQueueTest() | 58 MainThreadEventQueueTest() |
58 : main_task_runner_(new base::TestSimpleTaskRunner()), | 59 : main_task_runner_(new base::TestSimpleTaskRunner()), |
59 raf_aligned_input_setting_(GetParam()), | 60 raf_aligned_input_setting_(GetParam()), |
60 needs_main_frame_(false) { | 61 needs_main_frame_(false) { |
61 std::vector<std::string> features; | 62 std::vector<base::StringPiece> features; |
62 std::vector<std::string> disabled_features; | 63 std::vector<base::StringPiece> disabled_features; |
63 if (raf_aligned_input_setting_ & kRafAlignedEnabledTouch) { | 64 if (raf_aligned_input_setting_ & kRafAlignedEnabledTouch) { |
64 features.push_back(features::kRafAlignedTouchInputEvents.name); | 65 features.push_back(features::kRafAlignedTouchInputEvents.name); |
65 } else { | 66 } else { |
66 disabled_features.push_back(features::kRafAlignedTouchInputEvents.name); | 67 disabled_features.push_back(features::kRafAlignedTouchInputEvents.name); |
67 } | 68 } |
68 if (raf_aligned_input_setting_ & kRafAlignedEnabledMouse) { | 69 if (raf_aligned_input_setting_ & kRafAlignedEnabledMouse) { |
69 features.push_back(features::kRafAlignedMouseInputEvents.name); | 70 features.push_back(features::kRafAlignedMouseInputEvents.name); |
70 } else { | 71 } else { |
71 disabled_features.push_back(features::kRafAlignedMouseInputEvents.name); | 72 disabled_features.push_back(features::kRafAlignedMouseInputEvents.name); |
72 } | 73 } |
(...skipping 756 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
829 "MainThreadResponsivenessScrollIntervention", "Control"); | 830 "MainThreadResponsivenessScrollIntervention", "Control"); |
830 queue_ = new MainThreadEventQueue(kTestRoutingID, | 831 queue_ = new MainThreadEventQueue(kTestRoutingID, |
831 &dummy_main_thread_event_queue_client_, | 832 &dummy_main_thread_event_queue_client_, |
832 main_task_runner_, &renderer_scheduler_); | 833 main_task_runner_, &renderer_scheduler_); |
833 EXPECT_FALSE(enable_non_blocking_due_to_main_thread_responsiveness_flag()); | 834 EXPECT_FALSE(enable_non_blocking_due_to_main_thread_responsiveness_flag()); |
834 EXPECT_EQ(base::TimeDelta::FromMilliseconds(0), | 835 EXPECT_EQ(base::TimeDelta::FromMilliseconds(0), |
835 main_thread_responsiveness_threshold()); | 836 main_thread_responsiveness_threshold()); |
836 } | 837 } |
837 | 838 |
838 } // namespace content | 839 } // namespace content |
OLD | NEW |