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

Side by Side Diff: content/shell/common/webkit_test_helpers.cc

Issue 357203003: Move webpreferences.* from webkit/ to content/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: missed a comma - fix android_webview Created 6 years, 5 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 | Annotate | Revision Log
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 "content/shell/common/webkit_test_helpers.h" 5 #include "content/shell/common/webkit_test_helpers.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "base/strings/string_split.h" 10 #include "base/strings/string_split.h"
11 #include "base/strings/utf_string_conversions.h" 11 #include "base/strings/utf_string_conversions.h"
12 #include "content/public/common/content_switches.h" 12 #include "content/public/common/content_switches.h"
13 #include "content/public/common/web_preferences.h"
13 #include "content/shell/common/shell_switches.h" 14 #include "content/shell/common/shell_switches.h"
14 #include "content/shell/common/test_runner/test_preferences.h" 15 #include "content/shell/common/test_runner/test_preferences.h"
15 #include "webkit/common/webpreferences.h"
16 16
17 namespace content { 17 namespace content {
18 18
19 void ExportLayoutTestSpecificPreferences( 19 void ExportLayoutTestSpecificPreferences(const TestPreferences& from,
20 const TestPreferences& from, 20 WebPreferences* to) {
21 WebPreferences* to) {
22 to->allow_universal_access_from_file_urls = 21 to->allow_universal_access_from_file_urls =
23 from.allow_universal_access_from_file_urls; 22 from.allow_universal_access_from_file_urls;
24 to->dom_paste_enabled = from.dom_paste_allowed; 23 to->dom_paste_enabled = from.dom_paste_allowed;
25 to->javascript_can_access_clipboard = from.java_script_can_access_clipboard; 24 to->javascript_can_access_clipboard = from.java_script_can_access_clipboard;
26 to->xss_auditor_enabled = from.xss_auditor_enabled; 25 to->xss_auditor_enabled = from.xss_auditor_enabled;
27 to->editing_behavior = static_cast<webkit_glue::EditingBehavior>( 26 to->editing_behavior = static_cast<EditingBehavior>(from.editing_behavior);
28 from.editing_behavior);
29 to->default_font_size = from.default_font_size; 27 to->default_font_size = from.default_font_size;
30 to->minimum_font_size = from.minimum_font_size; 28 to->minimum_font_size = from.minimum_font_size;
31 to->default_encoding = from.default_text_encoding_name.utf8().data(); 29 to->default_encoding = from.default_text_encoding_name.utf8().data();
32 to->javascript_enabled = from.java_script_enabled; 30 to->javascript_enabled = from.java_script_enabled;
33 to->supports_multiple_windows = from.supports_multiple_windows; 31 to->supports_multiple_windows = from.supports_multiple_windows;
34 to->loads_images_automatically = from.loads_images_automatically; 32 to->loads_images_automatically = from.loads_images_automatically;
35 to->plugins_enabled = from.plugins_enabled; 33 to->plugins_enabled = from.plugins_enabled;
36 to->java_enabled = from.java_enabled; 34 to->java_enabled = from.java_enabled;
37 to->application_cache_enabled = from.offline_web_application_cache_enabled; 35 to->application_cache_enabled = from.offline_web_application_cache_enabled;
38 to->tabs_to_links = from.tabs_to_links; 36 to->tabs_to_links = from.tabs_to_links;
(...skipping 16 matching lines...) Expand all
55 // of the defaults are controlled via command line flags which are 53 // of the defaults are controlled via command line flags which are
56 // automatically set for layout tests. 54 // automatically set for layout tests.
57 void ApplyLayoutTestDefaultPreferences(WebPreferences* prefs) { 55 void ApplyLayoutTestDefaultPreferences(WebPreferences* prefs) {
58 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 56 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
59 prefs->allow_universal_access_from_file_urls = true; 57 prefs->allow_universal_access_from_file_urls = true;
60 prefs->dom_paste_enabled = true; 58 prefs->dom_paste_enabled = true;
61 prefs->javascript_can_access_clipboard = true; 59 prefs->javascript_can_access_clipboard = true;
62 prefs->xslt_enabled = true; 60 prefs->xslt_enabled = true;
63 prefs->xss_auditor_enabled = false; 61 prefs->xss_auditor_enabled = false;
64 #if defined(OS_MACOSX) 62 #if defined(OS_MACOSX)
65 prefs->editing_behavior = webkit_glue::EDITING_BEHAVIOR_MAC; 63 prefs->editing_behavior = EDITING_BEHAVIOR_MAC;
66 #else 64 #else
67 prefs->editing_behavior = webkit_glue::EDITING_BEHAVIOR_WIN; 65 prefs->editing_behavior = EDITING_BEHAVIOR_WIN;
68 #endif 66 #endif
69 prefs->java_enabled = false; 67 prefs->java_enabled = false;
70 prefs->application_cache_enabled = true; 68 prefs->application_cache_enabled = true;
71 prefs->tabs_to_links = false; 69 prefs->tabs_to_links = false;
72 prefs->hyperlink_auditing_enabled = false; 70 prefs->hyperlink_auditing_enabled = false;
73 prefs->allow_displaying_insecure_content = true; 71 prefs->allow_displaying_insecure_content = true;
74 prefs->allow_running_insecure_content = true; 72 prefs->allow_running_insecure_content = true;
75 prefs->webgl_errors_to_console_enabled = false; 73 prefs->webgl_errors_to_console_enabled = false;
76 base::string16 serif; 74 base::string16 serif;
77 #if defined(OS_MACOSX) 75 #if defined(OS_MACOSX)
78 prefs->cursive_font_family_map[webkit_glue::kCommonScript] = 76 prefs->cursive_font_family_map[kCommonScript] =
79 base::ASCIIToUTF16("Apple Chancery"); 77 base::ASCIIToUTF16("Apple Chancery");
80 prefs->fantasy_font_family_map[webkit_glue::kCommonScript] = 78 prefs->fantasy_font_family_map[kCommonScript] = base::ASCIIToUTF16("Papyrus");
81 base::ASCIIToUTF16("Papyrus");
82 serif = base::ASCIIToUTF16("Times"); 79 serif = base::ASCIIToUTF16("Times");
83 #else 80 #else
84 prefs->cursive_font_family_map[webkit_glue::kCommonScript] = 81 prefs->cursive_font_family_map[kCommonScript] =
85 base::ASCIIToUTF16("Comic Sans MS"); 82 base::ASCIIToUTF16("Comic Sans MS");
86 prefs->fantasy_font_family_map[webkit_glue::kCommonScript] = 83 prefs->fantasy_font_family_map[kCommonScript] = base::ASCIIToUTF16("Impact");
87 base::ASCIIToUTF16("Impact");
88 serif = base::ASCIIToUTF16("times new roman"); 84 serif = base::ASCIIToUTF16("times new roman");
89 #endif 85 #endif
90 prefs->serif_font_family_map[webkit_glue::kCommonScript] = 86 prefs->serif_font_family_map[kCommonScript] = serif;
91 serif; 87 prefs->standard_font_family_map[kCommonScript] = serif;
92 prefs->standard_font_family_map[webkit_glue::kCommonScript] = 88 prefs->fixed_font_family_map[kCommonScript] = base::ASCIIToUTF16("Courier");
93 serif; 89 prefs->sans_serif_font_family_map[kCommonScript] =
94 prefs->fixed_font_family_map[webkit_glue::kCommonScript] = 90 base::ASCIIToUTF16("Helvetica");
95 base::ASCIIToUTF16("Courier");
96 prefs->sans_serif_font_family_map[
97 webkit_glue::kCommonScript] = base::ASCIIToUTF16("Helvetica");
98 prefs->minimum_logical_font_size = 9; 91 prefs->minimum_logical_font_size = 9;
99 prefs->asynchronous_spell_checking_enabled = false; 92 prefs->asynchronous_spell_checking_enabled = false;
100 prefs->accelerated_2d_canvas_enabled = 93 prefs->accelerated_2d_canvas_enabled =
101 command_line.HasSwitch(switches::kEnableAccelerated2DCanvas); 94 command_line.HasSwitch(switches::kEnableAccelerated2DCanvas);
102 prefs->accelerated_compositing_for_video_enabled = false; 95 prefs->accelerated_compositing_for_video_enabled = false;
103 prefs->mock_scrollbars_enabled = false; 96 prefs->mock_scrollbars_enabled = false;
104 prefs->smart_insert_delete_enabled = true; 97 prefs->smart_insert_delete_enabled = true;
105 prefs->minimum_accelerated_2d_canvas_size = 0; 98 prefs->minimum_accelerated_2d_canvas_size = 0;
106 #if defined(OS_ANDROID) 99 #if defined(OS_ANDROID)
107 prefs->text_autosizing_enabled = false; 100 prefs->text_autosizing_enabled = false;
(...skipping 13 matching lines...) Expand all
121 if (command_line.HasSwitch(switches::kRegisterFontFiles)) { 114 if (command_line.HasSwitch(switches::kRegisterFontFiles)) {
122 base::SplitString( 115 base::SplitString(
123 command_line.GetSwitchValueASCII(switches::kRegisterFontFiles), 116 command_line.GetSwitchValueASCII(switches::kRegisterFontFiles),
124 ';', 117 ';',
125 &files); 118 &files);
126 } 119 }
127 return files; 120 return files;
128 } 121 }
129 122
130 } // namespace content 123 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698