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

Side by Side Diff: chrome/browser/ui/tab_contents/tab_contents_iterator_unittest.cc

Issue 2033173002: Moving Breakpad Windows specific logic to lower layer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix windows test. Created 4 years, 6 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/ui/tab_contents/tab_contents_iterator.h" 5 #include "chrome/browser/ui/tab_contents/tab_contents_iterator.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "build/build_config.h" 9 #include "build/build_config.h"
10 #include "chrome/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
11 #include "chrome/browser/browser_shutdown.h" 11 #include "chrome/browser/browser_shutdown.h"
12 #include "chrome/browser/lifetime/application_lifetime.h" 12 #include "chrome/browser/lifetime/application_lifetime.h"
13 #include "chrome/browser/profiles/profile_manager.h" 13 #include "chrome/browser/profiles/profile_manager.h"
14 #include "chrome/browser/ui/browser.h" 14 #include "chrome/browser/ui/browser.h"
15 #include "chrome/browser/ui/browser_commands.h" 15 #include "chrome/browser/ui/browser_commands.h"
16 #include "chrome/browser/ui/browser_list.h" 16 #include "chrome/browser/ui/browser_list.h"
17 #include "chrome/browser/ui/tabs/tab_strip_model.h" 17 #include "chrome/browser/ui/tabs/tab_strip_model.h"
18 #include "chrome/common/pref_names.h" 18 #include "chrome/common/pref_names.h"
19 #include "chrome/test/base/browser_with_test_window_test.h" 19 #include "chrome/test/base/browser_with_test_window_test.h"
20 #include "chrome/test/base/test_browser_window.h" 20 #include "chrome/test/base/test_browser_window.h"
21 #include "chrome/test/base/testing_browser_process.h" 21 #include "chrome/test/base/testing_browser_process.h"
22 #include "components/prefs/pref_registry_simple.h" 22 #include "components/prefs/pref_registry_simple.h"
23 #include "components/prefs/testing_pref_service.h" 23 #include "components/prefs/testing_pref_service.h"
24 24
25 #if defined(OS_WIN)
26 #include "components/metrics/metrics_pref_names.h"
27 #endif
28
25 typedef BrowserWithTestWindowTest BrowserListTest; 29 typedef BrowserWithTestWindowTest BrowserListTest;
26 30
27 namespace { 31 namespace {
28 32
29 // Helper function to iterate and count all the tabs. 33 // Helper function to iterate and count all the tabs.
30 size_t CountAllTabs() { 34 size_t CountAllTabs() {
31 size_t count = 0; 35 size_t count = 0;
32 for (TabContentsIterator iterator; !iterator.done(); iterator.Next()) 36 for (TabContentsIterator iterator; !iterator.done(); iterator.Next())
33 ++count; 37 ++count;
34 return count; 38 return count;
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 #else 168 #else
165 #define MAYBE_AttemptRestart AttemptRestart 169 #define MAYBE_AttemptRestart AttemptRestart
166 #endif 170 #endif
167 171
168 TEST_F(BrowserListTest, MAYBE_AttemptRestart) { 172 TEST_F(BrowserListTest, MAYBE_AttemptRestart) {
169 ASSERT_TRUE(g_browser_process); 173 ASSERT_TRUE(g_browser_process);
170 TestingPrefServiceSimple testing_pref_service; 174 TestingPrefServiceSimple testing_pref_service;
171 testing_pref_service.registry()->RegisterBooleanPref( 175 testing_pref_service.registry()->RegisterBooleanPref(
172 prefs::kWasRestarted, false); 176 prefs::kWasRestarted, false);
173 testing_pref_service.registry()->RegisterBooleanPref( 177 testing_pref_service.registry()->RegisterBooleanPref(
174 prefs::kRestartLastSessionOnShutdown, 178 prefs::kRestartLastSessionOnShutdown, false);
175 false); 179 #if defined(OS_WIN)
180 testing_pref_service.registry()->RegisterBooleanPref(
181 metrics::prefs::kMetricsReportingEnabled, false);
182 #endif
176 testing_pref_service.registry()->RegisterListPref( 183 testing_pref_service.registry()->RegisterListPref(
177 prefs::kProfilesLastActive); 184 prefs::kProfilesLastActive);
178 185
179 TestingBrowserProcess* testing_browser_process = 186 TestingBrowserProcess* testing_browser_process =
180 TestingBrowserProcess::GetGlobal(); 187 TestingBrowserProcess::GetGlobal();
181 testing_browser_process->SetLocalState(&testing_pref_service); 188 testing_browser_process->SetLocalState(&testing_pref_service);
182 ASSERT_TRUE(g_browser_process->local_state()); 189 ASSERT_TRUE(g_browser_process->local_state());
183 ProfileManager* profile_manager = new ProfileManager(base::FilePath()); 190 ProfileManager* profile_manager = new ProfileManager(base::FilePath());
184 testing_browser_process->SetProfileManager(profile_manager); 191 testing_browser_process->SetProfileManager(profile_manager);
185 192
186 chrome::AttemptRestart(); 193 chrome::AttemptRestart();
187 // Cancel the effects of us calling chrome::AttemptRestart. Otherwise tests 194 // Cancel the effects of us calling chrome::AttemptRestart. Otherwise tests
188 // ran after this one will fail. 195 // ran after this one will fail.
189 browser_shutdown::SetTryingToQuit(false); 196 browser_shutdown::SetTryingToQuit(false);
190 197
191 EXPECT_TRUE(testing_pref_service.GetBoolean(prefs::kWasRestarted)); 198 EXPECT_TRUE(testing_pref_service.GetBoolean(prefs::kWasRestarted));
192 testing_browser_process->SetLocalState(NULL); 199 testing_browser_process->SetLocalState(NULL);
193 } 200 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698