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

Side by Side Diff: chrome/browser/browser_process_impl_unittest.cc

Issue 1859213002: Move the thread hop for UMA user actions from content:: to base::. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Answered thestig@ and sgurun@ Created 4 years, 8 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/browser_process_impl.h" 5 #include "chrome/browser/browser_process_impl.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/metrics/user_metrics.h"
10 #include "base/run_loop.h" 11 #include "base/run_loop.h"
11 #include "base/thread_task_runner_handle.h" 12 #include "base/thread_task_runner_handle.h"
12 #include "build/build_config.h" 13 #include "build/build_config.h"
13 #include "chrome/browser/profiles/profile_manager.h" 14 #include "chrome/browser/profiles/profile_manager.h"
14 #include "chrome/browser/ui/webui/ntp/ntp_resource_cache_factory.h" 15 #include "chrome/browser/ui/webui/ntp/ntp_resource_cache_factory.h"
15 #include "chrome/test/base/testing_profile.h" 16 #include "chrome/test/base/testing_profile.h"
16 #include "content/public/test/test_browser_thread.h" 17 #include "content/public/test/test_browser_thread.h"
17 #include "testing/gtest/include/gtest/gtest.h" 18 #include "testing/gtest/include/gtest/gtest.h"
18 19
19 class BrowserProcessImplTest : public ::testing::Test { 20 class BrowserProcessImplTest : public ::testing::Test {
20 protected: 21 protected:
21 BrowserProcessImplTest() 22 BrowserProcessImplTest()
22 : stashed_browser_process_(g_browser_process), 23 : stashed_browser_process_(g_browser_process),
23 loop_(base::MessageLoop::TYPE_UI), 24 loop_(base::MessageLoop::TYPE_UI),
24 ui_thread_(content::BrowserThread::UI, &loop_), 25 ui_thread_(content::BrowserThread::UI, &loop_),
25 file_thread_( 26 file_thread_(
26 new content::TestBrowserThread(content::BrowserThread::FILE)), 27 new content::TestBrowserThread(content::BrowserThread::FILE)),
27 io_thread_(new content::TestBrowserThread(content::BrowserThread::IO)), 28 io_thread_(new content::TestBrowserThread(content::BrowserThread::IO)),
28 command_line_(base::CommandLine::NO_PROGRAM), 29 command_line_(base::CommandLine::NO_PROGRAM),
29 browser_process_impl_( 30 browser_process_impl_(
30 new BrowserProcessImpl(base::ThreadTaskRunnerHandle::Get().get(), 31 new BrowserProcessImpl(base::ThreadTaskRunnerHandle::Get().get(),
31 command_line_)) { 32 command_line_)) {
33 base::SetRecordActionTaskRunner(loop_.task_runner());
32 browser_process_impl_->SetApplicationLocale("en"); 34 browser_process_impl_->SetApplicationLocale("en");
33 } 35 }
34 36
35 ~BrowserProcessImplTest() override { 37 ~BrowserProcessImplTest() override {
36 g_browser_process = nullptr; 38 g_browser_process = nullptr;
37 browser_process_impl_.reset(); 39 browser_process_impl_.reset();
38 // Restore the original browser process. 40 // Restore the original browser process.
39 g_browser_process = stashed_browser_process_; 41 g_browser_process = stashed_browser_process_;
40 } 42 }
41 43
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 // Pass ownership to the ProfileManager so that it manages the destruction. 94 // Pass ownership to the ProfileManager so that it manages the destruction.
93 browser_process_impl()->profile_manager()->RegisterTestingProfile( 95 browser_process_impl()->profile_manager()->RegisterTestingProfile(
94 profile.release(), false, false); 96 profile.release(), false, false);
95 97
96 // Tear down the BrowserProcessImpl and the threads. 98 // Tear down the BrowserProcessImpl and the threads.
97 browser_process_impl()->StartTearDown(); 99 browser_process_impl()->StartTearDown();
98 DestroySecondaryThreads(); 100 DestroySecondaryThreads();
99 browser_process_impl()->PostDestroyThreads(); 101 browser_process_impl()->PostDestroyThreads();
100 } 102 }
101 #endif // !defined(OS_ANDROID) && !defined(OS_CHROMEOS) 103 #endif // !defined(OS_ANDROID) && !defined(OS_CHROMEOS)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698