1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "content/shell/browser/layout_test/layout_test_browser_main_parts.h"
7 #include "base/base_switches.h"
9 #include "base/command_line.h"
10 #include "base/files/file_path.h"
11 #include "base/message_loop/message_loop.h"
12 #include "base/threading/thread.h"
13 #include "base/threading/thread_restrictions.h"
14 #include "content/public/browser/browser_thread.h"
15 #include "content/public/browser/storage_partition.h"
16 #include "content/public/common/content_switches.h"
17 #include "content/public/common/main_function_params.h"
18 #include "content/public/common/url_constants.h"
19 #include "content/shell/browser/layout_test/layout_test_browser_context.h"
20 #include "content/shell/browser/shell.h"
21 #include "content/shell/browser/shell_browser_context.h"
22 #include "content/shell/browser/shell_devtools_manager_delegate.h"
23 #include "content/shell/browser/shell_net_log.h"
24 #include "content/shell/common/shell_switches.h"
25 #include "net/base/filename_util.h"
26 #include "net/base/net_module.h"
27 #include "net/grit/net_resources.h"
28 #include "storage/browser/quota/quota_manager.h"
29 #include "ui/base/resource/resource_bundle.h"
32 #if defined(ENABLE_PLUGINS)
33 #include "content/public/browser/plugin_service.h"
34 #include "content/shell/browser/shell_plugin_service_filter.h"
37 #if defined(OS_ANDROID)
38 #include "components/crash/browser/crash_dump_manager_android.h"
39 #include "net/android/network_change_notifier_factory_android.h"
40 #include "net/base/network_change_notifier.h"
43 #if defined(USE_AURA) && defined(USE_X11)
44 #include "ui/events/devices/x11/touch_factory_x11.h"
46 #if !defined(OS_CHROMEOS) && defined(USE_AURA) && defined(OS_LINUX)
47 #include "ui/base/ime/input_method_initializer.h"
54 // Default quota for each origin is 5MB.
55 const int kDefaultLayoutTestQuotaBytes
= 5 * 1024 * 1024;
59 LayoutTestBrowserMainParts::LayoutTestBrowserMainParts(
60 const MainFunctionParams
& parameters
)
61 : ShellBrowserMainParts(parameters
) {
64 LayoutTestBrowserMainParts::~LayoutTestBrowserMainParts() {
67 void LayoutTestBrowserMainParts::InitializeBrowserContexts() {
68 set_browser_context(new LayoutTestBrowserContext(false, net_log()));
69 set_off_the_record_browser_context(nullptr);
72 void LayoutTestBrowserMainParts::InitializeMessageLoopContext() {
73 storage::QuotaManager
* quota_manager
=
74 BrowserContext::GetDefaultStoragePartition(browser_context())
76 BrowserThread::PostTask(
79 base::Bind(&storage::QuotaManager::SetTemporaryGlobalOverrideQuota
,
81 kDefaultLayoutTestQuotaBytes
*
82 storage::QuotaManager::kPerHostTemporaryPortion
,
83 storage::QuotaCallback()));
85 #if defined(ENABLE_PLUGINS)
86 PluginService
* plugin_service
= PluginService::GetInstance();
87 plugin_service_filter_
.reset(new ShellPluginServiceFilter
);
88 plugin_service
->SetFilter(plugin_service_filter_
.get());