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

Side by Side Diff: chrome/browser/task_manager/sampling/shared_sampler_win_unittest.cc

Issue 2879943002: Use TaskScheduler instead of SequencedWorkerPool in shared_sampler_win_unittest.cc. (Closed)
Patch Set: Created 3 years, 7 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "chrome/browser/task_manager/sampling/shared_sampler.h" 5 #include "chrome/browser/task_manager/sampling/shared_sampler.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 8
9 #include <memory> 9 #include <memory>
10 10
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
14 #include "base/path_service.h" 14 #include "base/path_service.h"
15 #include "base/run_loop.h" 15 #include "base/run_loop.h"
16 #include "base/sequenced_task_runner.h" 16 #include "base/sequenced_task_runner.h"
17 #include "base/task_scheduler/post_task.h"
17 #include "base/threading/sequenced_worker_pool.h" 18 #include "base/threading/sequenced_worker_pool.h"
18 #include "base/time/time.h" 19 #include "base/time/time.h"
19 #include "chrome/browser/task_manager/sampling/shared_sampler_win_defines.h" 20 #include "chrome/browser/task_manager/sampling/shared_sampler_win_defines.h"
20 #include "chrome/browser/task_manager/task_manager_observer.h" 21 #include "chrome/browser/task_manager/task_manager_observer.h"
21 #include "content/public/browser/browser_thread.h" 22 #include "content/public/browser/browser_thread.h"
22 #include "content/public/test/test_browser_thread_bundle.h" 23 #include "content/public/test/test_browser_thread_bundle.h"
23 #include "testing/gtest/include/gtest/gtest.h" 24 #include "testing/gtest/include/gtest/gtest.h"
24 25
25 namespace task_manager { 26 namespace task_manager {
26 27
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 } 64 }
64 65
65 void WaitUntilRefreshDone() { 66 void WaitUntilRefreshDone() {
66 base::RunLoop run_loop; 67 base::RunLoop run_loop;
67 quit_closure_ = run_loop.QuitWhenIdleClosure(); 68 quit_closure_ = run_loop.QuitWhenIdleClosure();
68 run_loop.Run(); 69 run_loop.Run();
69 } 70 }
70 71
71 private: 72 private:
72 static scoped_refptr<base::SequencedTaskRunner> GetBlockingPoolRunner() { 73 static scoped_refptr<base::SequencedTaskRunner> GetBlockingPoolRunner() {
73 base::SequencedWorkerPool* blocking_pool = 74 return base::CreateSequencedTaskRunnerWithTraits({base::MayBlock()});
74 content::BrowserThread::GetBlockingPool();
75 return blocking_pool->GetSequencedTaskRunner(
76 blocking_pool->GetSequenceToken());
77 } 75 }
78 76
79 void OnRefreshTypeFinished(int64_t finished_refresh_type) { 77 void OnRefreshTypeFinished(int64_t finished_refresh_type) {
80 finished_refresh_type_ |= finished_refresh_type; 78 finished_refresh_type_ |= finished_refresh_type;
81 79
82 if (finished_refresh_type_ == expected_refresh_type_) 80 if (finished_refresh_type_ == expected_refresh_type_)
83 quit_closure_.Run(); 81 quit_closure_.Run();
84 } 82 }
85 83
86 void OnPhysicalMemoryUsageRefreshDone(int64_t physical_bytes) { 84 void OnPhysicalMemoryUsageRefreshDone(int64_t physical_bytes) {
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 EXPECT_EQ(REFRESH_TYPE_IDLE_WAKEUPS | REFRESH_TYPE_PHYSICAL_MEMORY | 247 EXPECT_EQ(REFRESH_TYPE_IDLE_WAKEUPS | REFRESH_TYPE_PHYSICAL_MEMORY |
250 REFRESH_TYPE_START_TIME | REFRESH_TYPE_CPU_TIME, 248 REFRESH_TYPE_START_TIME | REFRESH_TYPE_CPU_TIME,
251 finished_refresh_type()); 249 finished_refresh_type());
252 250
253 EXPECT_EQ(1024ll, physical_bytes()); 251 EXPECT_EQ(1024ll, physical_bytes());
254 252
255 SharedSampler::SetQuerySystemInformationForTest(nullptr); 253 SharedSampler::SetQuerySystemInformationForTest(nullptr);
256 } 254 }
257 255
258 } // namespace task_manager 256 } // namespace task_manager
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698