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

Side by Side Diff: chrome/test/base/in_process_browser_test.cc

Issue 2010463002: Mocker for OSCrypt (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated doc 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
« no previous file with comments | « chrome/test/BUILD.gn ('k') | components/autofill/core/browser/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/test/base/in_process_browser_test.h" 5 #include "chrome/test/base/in_process_browser_test.h"
6 6
7 #include "ash/ash_switches.h" 7 #include "ash/ash_switches.h"
8 #include "base/auto_reset.h" 8 #include "base/auto_reset.h"
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 #include "chrome/common/chrome_constants.h" 42 #include "chrome/common/chrome_constants.h"
43 #include "chrome/common/chrome_paths.h" 43 #include "chrome/common/chrome_paths.h"
44 #include "chrome/common/chrome_switches.h" 44 #include "chrome/common/chrome_switches.h"
45 #include "chrome/common/logging_chrome.h" 45 #include "chrome/common/logging_chrome.h"
46 #include "chrome/common/url_constants.h" 46 #include "chrome/common/url_constants.h"
47 #include "chrome/renderer/chrome_content_renderer_client.h" 47 #include "chrome/renderer/chrome_content_renderer_client.h"
48 #include "chrome/test/base/chrome_test_suite.h" 48 #include "chrome/test/base/chrome_test_suite.h"
49 #include "chrome/test/base/test_launcher_utils.h" 49 #include "chrome/test/base/test_launcher_utils.h"
50 #include "chrome/test/base/testing_browser_process.h" 50 #include "chrome/test/base/testing_browser_process.h"
51 #include "components/google/core/browser/google_util.h" 51 #include "components/google/core/browser/google_util.h"
52 #include "components/os_crypt/os_crypt.h" 52 #include "components/os_crypt/os_crypt_mocker.h"
53 #include "content/public/browser/devtools_agent_host.h" 53 #include "content/public/browser/devtools_agent_host.h"
54 #include "content/public/browser/notification_service.h" 54 #include "content/public/browser/notification_service.h"
55 #include "content/public/browser/notification_types.h" 55 #include "content/public/browser/notification_types.h"
56 #include "content/public/common/content_switches.h" 56 #include "content/public/common/content_switches.h"
57 #include "content/public/test/browser_test_utils.h" 57 #include "content/public/test/browser_test_utils.h"
58 #include "content/public/test/test_launcher.h" 58 #include "content/public/test/test_launcher.h"
59 #include "content/public/test/test_navigation_observer.h" 59 #include "content/public/test/test_navigation_observer.h"
60 #include "net/test/embedded_test_server/embedded_test_server.h" 60 #include "net/test/embedded_test_server/embedded_test_server.h"
61 61
62 #if defined(OS_MACOSX) 62 #if defined(OS_MACOSX)
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 // Disable IME extension loading to avoid many browser tests failures. 213 // Disable IME extension loading to avoid many browser tests failures.
214 chromeos::input_method::DisableExtensionLoading(); 214 chromeos::input_method::DisableExtensionLoading();
215 if (!command_line->HasSwitch(ash::switches::kAshHostWindowBounds)) { 215 if (!command_line->HasSwitch(ash::switches::kAshHostWindowBounds)) {
216 // Adjusting window location & size so that the ash desktop window fits 216 // Adjusting window location & size so that the ash desktop window fits
217 // inside the Xvfb'x defualt resolution. 217 // inside the Xvfb'x defualt resolution.
218 command_line->AppendSwitchASCII(ash::switches::kAshHostWindowBounds, 218 command_line->AppendSwitchASCII(ash::switches::kAshHostWindowBounds,
219 "0+0-1280x800"); 219 "0+0-1280x800");
220 } 220 }
221 #endif // defined(OS_CHROMEOS) 221 #endif // defined(OS_CHROMEOS)
222 222
223 #if defined(OS_MACOSX) 223 // Always use a mocked password storage if OS encryption is used (which is
224 // Always use the MockKeychain if OS encription is used (which is when 224 // when anything sensitive gets stored, including Cookies). Without this on
225 // anything sensitive gets stored, including Cookies). Without this, 225 // Mac, many tests will hang waiting for a user to approve KeyChain access.
226 // many tests will hang waiting for a user to approve KeyChain access. 226 OSCryptMocker::SetUpWithSingleton();
227 OSCrypt::UseMockKeychain(true);
228 #endif
229 227
230 #if defined(ENABLE_CAPTIVE_PORTAL_DETECTION) 228 #if defined(ENABLE_CAPTIVE_PORTAL_DETECTION)
231 CaptivePortalService::set_state_for_testing( 229 CaptivePortalService::set_state_for_testing(
232 CaptivePortalService::DISABLED_FOR_TESTING); 230 CaptivePortalService::DISABLED_FOR_TESTING);
233 #endif 231 #endif
234 232
235 chrome_browser_net::NetErrorTabHelper::set_state_for_testing( 233 chrome_browser_net::NetErrorTabHelper::set_state_for_testing(
236 chrome_browser_net::NetErrorTabHelper::TESTING_FORCE_DISABLED); 234 chrome_browser_net::NetErrorTabHelper::TESTING_FORCE_DISABLED);
237 235
238 google_util::SetMockLinkDoctorBaseURLForTesting(); 236 google_util::SetMockLinkDoctorBaseURLForTesting();
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 } 336 }
339 return test_launcher_utils::OverrideUserDataDir(user_data_dir); 337 return test_launcher_utils::OverrideUserDataDir(user_data_dir);
340 } 338 }
341 339
342 void InProcessBrowserTest::TearDown() { 340 void InProcessBrowserTest::TearDown() {
343 DCHECK(!g_browser_process); 341 DCHECK(!g_browser_process);
344 #if defined(OS_WIN) 342 #if defined(OS_WIN)
345 com_initializer_.reset(); 343 com_initializer_.reset();
346 #endif 344 #endif
347 BrowserTestBase::TearDown(); 345 BrowserTestBase::TearDown();
346 OSCryptMocker::TearDown();
348 } 347 }
349 348
350 void InProcessBrowserTest::CloseBrowserSynchronously(Browser* browser) { 349 void InProcessBrowserTest::CloseBrowserSynchronously(Browser* browser) {
351 content::WindowedNotificationObserver observer( 350 content::WindowedNotificationObserver observer(
352 chrome::NOTIFICATION_BROWSER_CLOSED, 351 chrome::NOTIFICATION_BROWSER_CLOSED,
353 content::Source<Browser>(browser)); 352 content::Source<Browser>(browser));
354 CloseBrowserAsynchronously(browser); 353 CloseBrowserAsynchronously(browser);
355 observer.Wait(); 354 observer.Wait();
356 } 355 }
357 356
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
592 // On the Mac, this eventually reaches 591 // On the Mac, this eventually reaches
593 // -[BrowserWindowController windowWillClose:], which will post a deferred 592 // -[BrowserWindowController windowWillClose:], which will post a deferred
594 // -autorelease on itself to ultimately destroy the Browser object. The line 593 // -autorelease on itself to ultimately destroy the Browser object. The line
595 // below is necessary to pump these pending messages to ensure all Browsers 594 // below is necessary to pump these pending messages to ensure all Browsers
596 // get deleted. 595 // get deleted.
597 content::RunAllPendingInMessageLoop(); 596 content::RunAllPendingInMessageLoop();
598 delete autorelease_pool_; 597 delete autorelease_pool_;
599 autorelease_pool_ = NULL; 598 autorelease_pool_ = NULL;
600 #endif 599 #endif
601 } 600 }
OLDNEW
« no previous file with comments | « chrome/test/BUILD.gn ('k') | components/autofill/core/browser/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698