Skip to content

Commit

Permalink
Update content/shell/common/test_runner to chromium coding style
Browse files Browse the repository at this point in the history
BUG=331299
TBR=maruel@chromium.org
R=marja@chromium.org

Review URL: https://codereview.chromium.org/225543003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@261881 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
jochen@chromium.org committed Apr 4, 2014
1 parent a7666d8 commit 1f70cfa
Show file tree
Hide file tree
Showing 12 changed files with 175 additions and 175 deletions.
1 change: 0 additions & 1 deletion PRESUBMIT.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
# checks until it's transitioned to chromium coding style.
_TESTRUNNER_PATHS = (
r"^content[\\\/]shell[\\\/]renderer[\\\/]test_runner[\\\/].*",
r"^content[\\\/]shell[\\\/]common[\\\/]test_runner[\\\/].*",
r"^content[\\\/]shell[\\\/]tools[\\\/]plugin[\\\/].*",
)

Expand Down
4 changes: 2 additions & 2 deletions content/content_shell.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,8 @@
'shell/common/shell_switches.h',
'shell/common/shell_test_configuration.cc',
'shell/common/shell_test_configuration.h',
'shell/common/test_runner/WebPreferences.cpp',
'shell/common/test_runner/WebPreferences.h',
'shell/common/test_runner/test_preferences.cc',
'shell/common/test_runner/test_preferences.h',
'shell/common/webkit_test_helpers.cc',
'shell/common/webkit_test_helpers.h',
'shell/geolocation/shell_access_token_store.cc',
Expand Down
55 changes: 0 additions & 55 deletions content/shell/common/test_runner/WebPreferences.cpp

This file was deleted.

53 changes: 0 additions & 53 deletions content/shell/common/test_runner/WebPreferences.h

This file was deleted.

54 changes: 54 additions & 0 deletions content/shell/common/test_runner/test_preferences.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "content/shell/common/test_runner/test_preferences.h"

#include "build/build_config.h"

using blink::WebSettings;
using blink::WebString;

namespace content {

TestPreferences::TestPreferences() { Reset(); }

void TestPreferences::Reset() {
default_font_size = 16;
minimum_font_size = 0;
dom_paste_allowed = true;
xss_auditor_enabled = false;
allow_display_of_insecure_content = true;
allow_file_access_from_file_urls = true;
allow_running_of_insecure_content = true;
default_text_encoding_name = WebString::fromUTF8("ISO-8859-1");
experimental_webgl_enabled = false;
experimental_css_regions_enabled = true;
experimental_css_grid_layout_enabled = true;
java_enabled = false;
java_script_can_access_clipboard = true;
java_script_can_open_windows_automatically = true;
supports_multiple_windows = true;
java_script_enabled = true;
loads_images_automatically = true;
offline_web_application_cache_enabled = true;
plugins_enabled = true;
caret_browsing_enabled = false;

// Allow those layout tests running as local files, i.e. under
// LayoutTests/http/tests/local, to access http server.
allow_universal_access_from_file_urls = true;

#if defined(OS_MACOSX)
editing_behavior = WebSettings::EditingBehaviorMac;
#else
editing_behavior = WebSettings::EditingBehaviorWin;
#endif

tabs_to_links = false;
hyperlink_auditing_enabled = false;
should_respect_image_orientation = false;
asynchronous_spell_checking_enabled = false;
}

} // namespace content
53 changes: 53 additions & 0 deletions content/shell/common/test_runner/test_preferences.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CONTENT_SHELL_COMMON_TEST_RUNNER_TEST_PREFERENCES_H_
#define CONTENT_SHELL_COMMON_TEST_RUNNER_TEST_PREFERENCES_H_

#include "third_party/WebKit/public/platform/WebString.h"
#include "third_party/WebKit/public/platform/WebURL.h"
#include "third_party/WebKit/public/web/WebSettings.h"

namespace blink {
class WebView;
}

namespace content {

struct TestPreferences {
int default_font_size;
int minimum_font_size;
bool dom_paste_allowed;
bool xss_auditor_enabled;
bool allow_display_of_insecure_content;
bool allow_file_access_from_file_urls;
bool allow_running_of_insecure_content;
bool author_and_user_styles_enabled;
blink::WebString default_text_encoding_name;
bool experimental_webgl_enabled;
bool experimental_css_regions_enabled;
bool experimental_css_grid_layout_enabled;
bool java_enabled;
bool java_script_can_access_clipboard;
bool java_script_can_open_windows_automatically;
bool supports_multiple_windows;
bool java_script_enabled;
bool loads_images_automatically;
bool offline_web_application_cache_enabled;
bool plugins_enabled;
bool allow_universal_access_from_file_urls;
blink::WebSettings::EditingBehavior editing_behavior;
bool tabs_to_links;
bool hyperlink_auditing_enabled;
bool caret_browsing_enabled;
bool should_respect_image_orientation;
bool asynchronous_spell_checking_enabled;

TestPreferences();
void Reset();
};

}

#endif // CONTENT_SHELL_COMMON_TEST_RUNNER_TEST_PREFERENCES_H_
53 changes: 27 additions & 26 deletions content/shell/common/webkit_test_helpers.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,43 +10,44 @@
#include "base/strings/utf_string_conversions.h"
#include "content/public/common/content_switches.h"
#include "content/shell/common/shell_switches.h"
#include "content/shell/common/test_runner/WebPreferences.h"
#include "content/shell/common/test_runner/test_preferences.h"
#include "webkit/common/webpreferences.h"

namespace content {

void ExportLayoutTestSpecificPreferences(
const WebTestRunner::WebPreferences& from,
const TestPreferences& from,
WebPreferences* to) {
to->allow_universal_access_from_file_urls =
from.allowUniversalAccessFromFileURLs;
to->dom_paste_enabled = from.DOMPasteAllowed;
to->javascript_can_access_clipboard = from.javaScriptCanAccessClipboard;
to->xss_auditor_enabled = from.XSSAuditorEnabled;
from.allow_universal_access_from_file_urls;
to->dom_paste_enabled = from.dom_paste_allowed;
to->javascript_can_access_clipboard = from.java_script_can_access_clipboard;
to->xss_auditor_enabled = from.xss_auditor_enabled;
to->editing_behavior = static_cast<webkit_glue::EditingBehavior>(
from.editingBehavior);
to->default_font_size = from.defaultFontSize;
to->minimum_font_size = from.minimumFontSize;
to->default_encoding = from.defaultTextEncodingName.utf8().data();
to->javascript_enabled = from.javaScriptEnabled;
to->supports_multiple_windows = from.supportsMultipleWindows;
to->loads_images_automatically = from.loadsImagesAutomatically;
to->plugins_enabled = from.pluginsEnabled;
to->java_enabled = from.javaEnabled;
to->application_cache_enabled = from.offlineWebApplicationCacheEnabled;
to->tabs_to_links = from.tabsToLinks;
to->experimental_webgl_enabled = from.experimentalWebGLEnabled;
from.editing_behavior);
to->default_font_size = from.default_font_size;
to->minimum_font_size = from.minimum_font_size;
to->default_encoding = from.default_text_encoding_name.utf8().data();
to->javascript_enabled = from.java_script_enabled;
to->supports_multiple_windows = from.supports_multiple_windows;
to->loads_images_automatically = from.loads_images_automatically;
to->plugins_enabled = from.plugins_enabled;
to->java_enabled = from.java_enabled;
to->application_cache_enabled = from.offline_web_application_cache_enabled;
to->tabs_to_links = from.tabs_to_links;
to->experimental_webgl_enabled = from.experimental_webgl_enabled;
// experimentalCSSRegionsEnabled is deprecated and ignored.
to->hyperlink_auditing_enabled = from.hyperlinkAuditingEnabled;
to->caret_browsing_enabled = from.caretBrowsingEnabled;
to->allow_displaying_insecure_content = from.allowDisplayOfInsecureContent;
to->allow_running_insecure_content = from.allowRunningOfInsecureContent;
to->should_respect_image_orientation = from.shouldRespectImageOrientation;
to->hyperlink_auditing_enabled = from.hyperlink_auditing_enabled;
to->caret_browsing_enabled = from.caret_browsing_enabled;
to->allow_displaying_insecure_content =
from.allow_display_of_insecure_content;
to->allow_running_insecure_content = from.allow_running_of_insecure_content;
to->should_respect_image_orientation = from.should_respect_image_orientation;
to->asynchronous_spell_checking_enabled =
from.asynchronousSpellCheckingEnabled;
to->allow_file_access_from_file_urls = from.allowFileAccessFromFileURLs;
from.asynchronous_spell_checking_enabled;
to->allow_file_access_from_file_urls = from.allow_file_access_from_file_urls;
to->javascript_can_open_windows_automatically =
from.javaScriptCanOpenWindowsAutomatically;
from.java_script_can_open_windows_automatically;
}

// Applies settings that differ between layout tests and regular mode. Some
Expand Down
8 changes: 3 additions & 5 deletions content/shell/common/webkit_test_helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@

struct WebPreferences;

namespace WebTestRunner {
struct WebPreferences;
}

namespace base {
class FilePath;
}
Expand All @@ -19,12 +15,14 @@ struct WebPreferences;

namespace content {

struct TestPreferences;

// The TestRunner library keeps its settings in a WebTestRunner::WebPreferenes
// object. The content_shell, however, uses WebPreferences. This
// method exports the settings from the WebTestRunner library which are relevant
// for layout tests.
void ExportLayoutTestSpecificPreferences(
const WebTestRunner::WebPreferences& from, WebPreferences* to);
const TestPreferences& from, WebPreferences* to);

// Applies settings that differ between layout tests and regular mode.
void ApplyLayoutTestDefaultPreferences(WebPreferences* prefs);
Expand Down
7 changes: 5 additions & 2 deletions content/shell/renderer/test_runner/WebTestDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,12 @@ struct WebSize;
struct WebURLError;
}

namespace content {
struct TestPreferences;
}

namespace WebTestRunner {

struct WebPreferences;
class WebTask;
class WebTestProxyBase;

Expand Down Expand Up @@ -82,7 +85,7 @@ class WebTestDelegate {
virtual blink::WebURL rewriteLayoutTestsURL(const std::string& utf8URL) = 0;

// Manages the settings to used for layout tests.
virtual WebPreferences* preferences() = 0;
virtual content::TestPreferences* preferences() = 0;
virtual void applyPreferences() = 0;

// Enables or disables synchronous resize mode. When enabled, all window-sizing machinery is
Expand Down
Loading

0 comments on commit 1f70cfa

Please sign in to comment.