OLD | NEW |
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/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
11 #include "content/public/common/content_switches.h" | 11 #include "content/public/common/content_switches.h" |
| 12 #include "content/public/common/webpreferences.h" |
12 #include "content/shell/common/shell_switches.h" | 13 #include "content/shell/common/shell_switches.h" |
13 #include "content/shell/common/test_runner/WebPreferences.h" | 14 #include "content/shell/common/test_runner/WebPreferences.h" |
14 #include "webkit/common/webpreferences.h" | |
15 | 15 |
16 namespace content { | 16 namespace content { |
17 | 17 |
18 void ExportLayoutTestSpecificPreferences( | 18 void ExportLayoutTestSpecificPreferences( |
19 const WebTestRunner::WebPreferences& from, | 19 const WebTestRunner::WebPreferences& from, |
20 WebPreferences* to) { | 20 WebPreferences* to) { |
21 to->allow_universal_access_from_file_urls = | 21 to->allow_universal_access_from_file_urls = |
22 from.allowUniversalAccessFromFileURLs; | 22 from.allowUniversalAccessFromFileURLs; |
23 to->dom_paste_enabled = from.DOMPasteAllowed; | 23 to->dom_paste_enabled = from.DOMPasteAllowed; |
24 to->javascript_can_access_clipboard = from.javaScriptCanAccessClipboard; | 24 to->javascript_can_access_clipboard = from.javaScriptCanAccessClipboard; |
25 to->xss_auditor_enabled = from.XSSAuditorEnabled; | 25 to->xss_auditor_enabled = from.XSSAuditorEnabled; |
26 to->editing_behavior = static_cast<webkit_glue::EditingBehavior>( | 26 to->editing_behavior = static_cast<content::EditingBehavior>( |
27 from.editingBehavior); | 27 from.editingBehavior); |
28 to->default_font_size = from.defaultFontSize; | 28 to->default_font_size = from.defaultFontSize; |
29 to->minimum_font_size = from.minimumFontSize; | 29 to->minimum_font_size = from.minimumFontSize; |
30 to->default_encoding = from.defaultTextEncodingName.utf8().data(); | 30 to->default_encoding = from.defaultTextEncodingName.utf8().data(); |
31 to->javascript_enabled = from.javaScriptEnabled; | 31 to->javascript_enabled = from.javaScriptEnabled; |
32 to->supports_multiple_windows = from.supportsMultipleWindows; | 32 to->supports_multiple_windows = from.supportsMultipleWindows; |
33 to->loads_images_automatically = from.loadsImagesAutomatically; | 33 to->loads_images_automatically = from.loadsImagesAutomatically; |
34 to->plugins_enabled = from.pluginsEnabled; | 34 to->plugins_enabled = from.pluginsEnabled; |
35 to->java_enabled = from.javaEnabled; | 35 to->java_enabled = from.javaEnabled; |
36 to->application_cache_enabled = from.offlineWebApplicationCacheEnabled; | 36 to->application_cache_enabled = from.offlineWebApplicationCacheEnabled; |
(...skipping 16 matching lines...) Expand all Loading... |
53 // of the defaults are controlled via command line flags which are | 53 // of the defaults are controlled via command line flags which are |
54 // automatically set for layout tests. | 54 // automatically set for layout tests. |
55 void ApplyLayoutTestDefaultPreferences(WebPreferences* prefs) { | 55 void ApplyLayoutTestDefaultPreferences(WebPreferences* prefs) { |
56 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 56 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
57 prefs->allow_universal_access_from_file_urls = true; | 57 prefs->allow_universal_access_from_file_urls = true; |
58 prefs->dom_paste_enabled = true; | 58 prefs->dom_paste_enabled = true; |
59 prefs->javascript_can_access_clipboard = true; | 59 prefs->javascript_can_access_clipboard = true; |
60 prefs->xslt_enabled = true; | 60 prefs->xslt_enabled = true; |
61 prefs->xss_auditor_enabled = false; | 61 prefs->xss_auditor_enabled = false; |
62 #if defined(OS_MACOSX) | 62 #if defined(OS_MACOSX) |
63 prefs->editing_behavior = webkit_glue::EDITING_BEHAVIOR_MAC; | 63 prefs->editing_behavior = content::EDITING_BEHAVIOR_MAC; |
64 #else | 64 #else |
65 prefs->editing_behavior = webkit_glue::EDITING_BEHAVIOR_WIN; | 65 prefs->editing_behavior = content::EDITING_BEHAVIOR_WIN; |
66 #endif | 66 #endif |
67 prefs->java_enabled = false; | 67 prefs->java_enabled = false; |
68 prefs->application_cache_enabled = true; | 68 prefs->application_cache_enabled = true; |
69 prefs->tabs_to_links = false; | 69 prefs->tabs_to_links = false; |
70 prefs->hyperlink_auditing_enabled = false; | 70 prefs->hyperlink_auditing_enabled = false; |
71 prefs->allow_displaying_insecure_content = true; | 71 prefs->allow_displaying_insecure_content = true; |
72 prefs->allow_running_insecure_content = true; | 72 prefs->allow_running_insecure_content = true; |
73 prefs->webgl_errors_to_console_enabled = false; | 73 prefs->webgl_errors_to_console_enabled = false; |
74 base::string16 serif; | 74 base::string16 serif; |
75 #if defined(OS_MACOSX) | 75 #if defined(OS_MACOSX) |
76 prefs->cursive_font_family_map[webkit_glue::kCommonScript] = | 76 prefs->cursive_font_family_map[content::kCommonScript] = |
77 base::ASCIIToUTF16("Apple Chancery"); | 77 base::ASCIIToUTF16("Apple Chancery"); |
78 prefs->fantasy_font_family_map[webkit_glue::kCommonScript] = | 78 prefs->fantasy_font_family_map[content::kCommonScript] = |
79 base::ASCIIToUTF16("Papyrus"); | 79 base::ASCIIToUTF16("Papyrus"); |
80 serif = base::ASCIIToUTF16("Times"); | 80 serif = base::ASCIIToUTF16("Times"); |
81 #else | 81 #else |
82 prefs->cursive_font_family_map[webkit_glue::kCommonScript] = | 82 prefs->cursive_font_family_map[content::kCommonScript] = |
83 base::ASCIIToUTF16("Comic Sans MS"); | 83 base::ASCIIToUTF16("Comic Sans MS"); |
84 prefs->fantasy_font_family_map[webkit_glue::kCommonScript] = | 84 prefs->fantasy_font_family_map[content::kCommonScript] = |
85 base::ASCIIToUTF16("Impact"); | 85 base::ASCIIToUTF16("Impact"); |
86 serif = base::ASCIIToUTF16("times new roman"); | 86 serif = base::ASCIIToUTF16("times new roman"); |
87 #endif | 87 #endif |
88 prefs->serif_font_family_map[webkit_glue::kCommonScript] = | 88 prefs->serif_font_family_map[content::kCommonScript] = |
89 serif; | 89 serif; |
90 prefs->standard_font_family_map[webkit_glue::kCommonScript] = | 90 prefs->standard_font_family_map[content::kCommonScript] = |
91 serif; | 91 serif; |
92 prefs->fixed_font_family_map[webkit_glue::kCommonScript] = | 92 prefs->fixed_font_family_map[content::kCommonScript] = |
93 base::ASCIIToUTF16("Courier"); | 93 base::ASCIIToUTF16("Courier"); |
94 prefs->sans_serif_font_family_map[ | 94 prefs->sans_serif_font_family_map[ |
95 webkit_glue::kCommonScript] = base::ASCIIToUTF16("Helvetica"); | 95 content::kCommonScript] = base::ASCIIToUTF16("Helvetica"); |
96 prefs->minimum_logical_font_size = 9; | 96 prefs->minimum_logical_font_size = 9; |
97 prefs->asynchronous_spell_checking_enabled = false; | 97 prefs->asynchronous_spell_checking_enabled = false; |
98 prefs->threaded_html_parser = true; | 98 prefs->threaded_html_parser = true; |
99 prefs->accelerated_2d_canvas_enabled = | 99 prefs->accelerated_2d_canvas_enabled = |
100 command_line.HasSwitch(switches::kEnableAccelerated2DCanvas); | 100 command_line.HasSwitch(switches::kEnableAccelerated2DCanvas); |
101 prefs->force_compositing_mode = | 101 prefs->force_compositing_mode = |
102 command_line.HasSwitch(switches::kForceCompositingMode); | 102 command_line.HasSwitch(switches::kForceCompositingMode); |
103 prefs->accelerated_compositing_for_video_enabled = false; | 103 prefs->accelerated_compositing_for_video_enabled = false; |
104 prefs->mock_scrollbars_enabled = false; | 104 prefs->mock_scrollbars_enabled = false; |
105 prefs->fixed_position_creates_stacking_context = false; | 105 prefs->fixed_position_creates_stacking_context = false; |
106 prefs->smart_insert_delete_enabled = true; | 106 prefs->smart_insert_delete_enabled = true; |
107 prefs->minimum_accelerated_2d_canvas_size = 0; | 107 prefs->minimum_accelerated_2d_canvas_size = 0; |
108 #if defined(OS_ANDROID) | 108 #if defined(OS_ANDROID) |
109 prefs->text_autosizing_enabled = false; | 109 prefs->text_autosizing_enabled = false; |
110 #endif | 110 #endif |
111 prefs->viewport_enabled = false; | 111 prefs->viewport_enabled = false; |
112 } | 112 } |
113 | 113 |
114 base::FilePath GetWebKitRootDirFilePath() { | 114 base::FilePath GetWebKitRootDirFilePath() { |
115 base::FilePath base_path; | 115 base::FilePath base_path; |
116 PathService::Get(base::DIR_SOURCE_ROOT, &base_path); | 116 PathService::Get(base::DIR_SOURCE_ROOT, &base_path); |
117 return base_path.Append(FILE_PATH_LITERAL("third_party/WebKit")); | 117 return base_path.Append(FILE_PATH_LITERAL("third_party/WebKit")); |
118 } | 118 } |
119 | 119 |
120 } // namespace content | 120 } // namespace content |
OLD | NEW |