diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2017-09-18 14:34:04 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2017-10-04 11:15:27 +0000 |
commit | e6430e577f105ad8813c92e75c54660c4985026e (patch) | |
tree | 88115e5d1fb471fea807111924dcccbeadbf9e4f /chromium/content/browser/browser_main_loop_unittest.cc | |
parent | 53d399fe6415a96ea6986ec0d402a9c07da72453 (diff) | |
download | qtwebengine-chromium-e6430e577f105ad8813c92e75c54660c4985026e.tar.gz |
BASELINE: Update Chromium to 61.0.3163.99
Change-Id: I8452f34574d88ca2b27af9bd56fc9ff3f16b1367
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'chromium/content/browser/browser_main_loop_unittest.cc')
-rw-r--r-- | chromium/content/browser/browser_main_loop_unittest.cc | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/chromium/content/browser/browser_main_loop_unittest.cc b/chromium/content/browser/browser_main_loop_unittest.cc new file mode 100644 index 00000000000..3e2f04f04ec --- /dev/null +++ b/chromium/content/browser/browser_main_loop_unittest.cc @@ -0,0 +1,41 @@ +// Copyright 2017 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 "content/browser/browser_main_loop.h" + +#include "base/command_line.h" +#include "base/message_loop/message_loop.h" +#include "base/sys_info.h" +#include "base/task_scheduler/task_scheduler.h" +#include "base/test/scoped_command_line.h" +#include "content/public/common/content_switches.h" +#include "content/public/common/main_function_params.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace content { + +// Verify that a single-process browser process has at least as many threads as +// the number of cores in its foreground pool. +TEST(BrowserMainLoopTest, CreateThreadsInSingleProcess) { + { + base::MessageLoop message_loop; + base::test::ScopedCommandLine scoped_command_line; + scoped_command_line.GetProcessCommandLine()->AppendSwitch( + switches::kSingleProcess); + MainFunctionParams main_function_params( + *scoped_command_line.GetProcessCommandLine()); + BrowserMainLoop browser_main_loop(main_function_params); + browser_main_loop.MainMessageLoopStart(); + browser_main_loop.CreateThreads(); + EXPECT_GE(base::TaskScheduler::GetInstance() + ->GetMaxConcurrentTasksWithTraitsDeprecated( + {base::TaskPriority::USER_VISIBLE}), + base::SysInfo::NumberOfProcessors()); + browser_main_loop.ShutdownThreadsAndCleanUp(); + } + base::TaskScheduler::GetInstance()->JoinForTesting(); + base::TaskScheduler::SetInstance(nullptr); +} + +} // namespace content |