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

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

Issue 2913733002: Add a browser test for access control for file: scheme (Closed)
Patch Set: Address comments Created 3 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/test/base/in_process_browser_test.h" 5 #include "chrome/test/base/in_process_browser_test.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/feature_list.h" 10 #include "base/feature_list.h"
11 #include "base/files/file_path.h" 11 #include "base/files/file_path.h"
12 #include "base/files/file_util.h" 12 #include "base/files/file_util.h"
13 #include "base/lazy_instance.h" 13 #include "base/lazy_instance.h"
14 #include "base/location.h" 14 #include "base/location.h"
15 #include "base/macros.h" 15 #include "base/macros.h"
16 #include "base/path_service.h" 16 #include "base/path_service.h"
17 #include "base/single_thread_task_runner.h" 17 #include "base/single_thread_task_runner.h"
18 #include "base/strings/string_number_conversions.h" 18 #include "base/strings/string_number_conversions.h"
19 #include "base/test/test_file_util.h" 19 #include "base/test/test_file_util.h"
20 #include "base/threading/non_thread_safe.h" 20 #include "base/threading/non_thread_safe.h"
21 #include "base/threading/thread_task_runner_handle.h" 21 #include "base/threading/thread_task_runner_handle.h"
22 #include "build/build_config.h" 22 #include "build/build_config.h"
23 #include "chrome/browser/after_startup_task_utils.h" 23 #include "chrome/browser/after_startup_task_utils.h"
24 #include "chrome/browser/browser_process.h" 24 #include "chrome/browser/browser_process.h"
25 #include "chrome/browser/chrome_content_browser_client.h" 25 #include "chrome/browser/chrome_content_browser_client.h"
26 #include "chrome/browser/chrome_notification_types.h" 26 #include "chrome/browser/chrome_notification_types.h"
27 #include "chrome/browser/devtools/devtools_window.h" 27 #include "chrome/browser/devtools/devtools_window.h"
28 #include "chrome/browser/lifetime/application_lifetime.h" 28 #include "chrome/browser/lifetime/application_lifetime.h"
29 #include "chrome/browser/lifetime/termination_notification.h" 29 #include "chrome/browser/lifetime/termination_notification.h"
30 #include "chrome/browser/net/chrome_network_delegate.h"
30 #include "chrome/browser/net/net_error_tab_helper.h" 31 #include "chrome/browser/net/net_error_tab_helper.h"
31 #include "chrome/browser/profiles/profile.h" 32 #include "chrome/browser/profiles/profile.h"
32 #include "chrome/browser/profiles/profile_manager.h" 33 #include "chrome/browser/profiles/profile_manager.h"
33 #include "chrome/browser/ui/browser.h" 34 #include "chrome/browser/ui/browser.h"
34 #include "chrome/browser/ui/browser_commands.h" 35 #include "chrome/browser/ui/browser_commands.h"
35 #include "chrome/browser/ui/browser_finder.h" 36 #include "chrome/browser/ui/browser_finder.h"
36 #include "chrome/browser/ui/browser_list.h" 37 #include "chrome/browser/ui/browser_list.h"
37 #include "chrome/browser/ui/browser_list_observer.h" 38 #include "chrome/browser/ui/browser_list_observer.h"
38 #include "chrome/browser/ui/browser_navigator.h" 39 #include "chrome/browser/ui/browser_navigator.h"
39 #include "chrome/browser/ui/browser_navigator_params.h" 40 #include "chrome/browser/ui/browser_navigator_params.h"
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 249
249 chrome_browser_net::NetErrorTabHelper::set_state_for_testing( 250 chrome_browser_net::NetErrorTabHelper::set_state_for_testing(
250 chrome_browser_net::NetErrorTabHelper::TESTING_FORCE_DISABLED); 251 chrome_browser_net::NetErrorTabHelper::TESTING_FORCE_DISABLED);
251 252
252 google_util::SetMockLinkDoctorBaseURLForTesting(); 253 google_util::SetMockLinkDoctorBaseURLForTesting();
253 254
254 #if defined(OS_CHROMEOS) 255 #if defined(OS_CHROMEOS)
255 // Polymer Elements are used for quick unlock configuration in options page, 256 // Polymer Elements are used for quick unlock configuration in options page,
256 // which is chromeos specific feature. 257 // which is chromeos specific feature.
257 options::BrowserOptionsHandler::DisablePolymerPreloadForTesting(); 258 options::BrowserOptionsHandler::DisablePolymerPreloadForTesting();
259 // browser_tests and interactive_ui_tests rely on the ability to open any
sky 2017/06/06 17:18:26 How come you are only enabling this on chromeos?
mmenke1 2017/06/06 17:23:41 Only on ChromeOS (And Android) do we restrict what
sky 2017/06/06 20:45:36 Please update the comment to indicate this then.
satorux1 2017/06/07 08:00:38 Done.
260 // files via file: scheme.
261 ChromeNetworkDelegate::EnableAccessToAllFilesForTesting(true);
258 #endif // defined(OS_CHROMEOS) 262 #endif // defined(OS_CHROMEOS)
259 263
260 // Use hardcoded quota settings to have a consistent testing environment. 264 // Use hardcoded quota settings to have a consistent testing environment.
261 const int kQuota = 5 * 1024 * 1024; 265 const int kQuota = 5 * 1024 * 1024;
262 quota_settings_ = storage::QuotaSettings(kQuota * 5, kQuota, 0, 0); 266 quota_settings_ = storage::QuotaSettings(kQuota * 5, kQuota, 0, 0);
263 ChromeContentBrowserClient::SetDefaultQuotaSettingsForTesting( 267 ChromeContentBrowserClient::SetDefaultQuotaSettingsForTesting(
264 &quota_settings_); 268 &quota_settings_);
265 269
266 BrowserTestBase::SetUp(); 270 BrowserTestBase::SetUp();
267 } 271 }
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
623 // On the Mac, this eventually reaches 627 // On the Mac, this eventually reaches
624 // -[BrowserWindowController windowWillClose:], which will post a deferred 628 // -[BrowserWindowController windowWillClose:], which will post a deferred
625 // -autorelease on itself to ultimately destroy the Browser object. The line 629 // -autorelease on itself to ultimately destroy the Browser object. The line
626 // below is necessary to pump these pending messages to ensure all Browsers 630 // below is necessary to pump these pending messages to ensure all Browsers
627 // get deleted. 631 // get deleted.
628 content::RunAllPendingInMessageLoop(); 632 content::RunAllPendingInMessageLoop();
629 delete autorelease_pool_; 633 delete autorelease_pool_;
630 autorelease_pool_ = NULL; 634 autorelease_pool_ = NULL;
631 #endif 635 #endif
632 } 636 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698