summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-01 15:23:56 +0000
committerthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-01 15:23:56 +0000
commit678e68ab1a5fa99f07634cce9ac22a6d700436df (patch)
tree86faec083f04f6b58b7366f5750cb802d16a5d0e
parentd49eebd7d137ca82ee7eeb206788a24fb99b7dbc (diff)
downloadchromium_src-678e68ab1a5fa99f07634cce9ac22a6d700436df.zip
chromium_src-678e68ab1a5fa99f07634cce9ac22a6d700436df.tar.gz
chromium_src-678e68ab1a5fa99f07634cce9ac22a6d700436df.tar.bz2
Enable smooth scrolling on mac
This confuses a few unit tests, so add some machinery to disable the feature in tests and do so in the tests that need it. BUG=61140,575 TEST=Go to en.wikipedia.org, hit space. Scroll should be animated. Review URL: http://codereview.chromium.org/7693019 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@99186 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--base/test/mock_time_provider.h7
-rw-r--r--build/common.gypi4
-rw-r--r--chrome/browser/tab_contents/render_view_host_delegate_helper.cc14
-rw-r--r--chrome/test/ui/ppapi_uitest.cc4
-rw-r--r--content/common/content_switches.cc3
-rw-r--r--content/common/content_switches.h1
-rw-r--r--content/renderer/render_view.h1
-rw-r--r--content/renderer/render_view_browsertest_mac.mm6
8 files changed, 32 insertions, 8 deletions
diff --git a/base/test/mock_time_provider.h b/base/test/mock_time_provider.h
index 9ff46e4..48ddb41 100644
--- a/base/test/mock_time_provider.h
+++ b/base/test/mock_time_provider.h
@@ -39,11 +39,12 @@
// ASSERT_EQ(elapsed, TimeDelta::FromSeconds(6));
// }
-#include "base/time.h"
-#include "testing/gmock/include/gmock/gmock.h"
-
#ifndef BASE_TEST_MOCK_TIME_PROVIDER_H_
#define BASE_TEST_MOCK_TIME_PROVIDER_H_
+#pragma once
+
+#include "base/time.h"
+#include "testing/gmock/include/gmock/gmock.h"
namespace base {
diff --git a/build/common.gypi b/build/common.gypi
index b6f7fe8..a19b002 100644
--- a/build/common.gypi
+++ b/build/common.gypi
@@ -277,8 +277,8 @@
'webui_task_manager%': 0,
}],
- # Enable smooth scrolling for Linux and ChromeOS
- ['OS=="linux"', {
+ # Enable smooth scrolling for Mac, Linux and ChromeOS
+ ['OS=="linux" or OS=="mac"', {
'enable_smooth_scrolling%': 1,
}, {
'enable_smooth_scrolling%': 0,
diff --git a/chrome/browser/tab_contents/render_view_host_delegate_helper.cc b/chrome/browser/tab_contents/render_view_host_delegate_helper.cc
index 4958bc8..d82f08b 100644
--- a/chrome/browser/tab_contents/render_view_host_delegate_helper.cc
+++ b/chrome/browser/tab_contents/render_view_host_delegate_helper.cc
@@ -460,8 +460,18 @@ WebPreferences RenderViewHostDelegateHelper::GetWebkitPrefs(
prefs->GetBoolean(prefs::kWebKitAllowDisplayingInsecureContent);
web_prefs.allow_running_insecure_content =
prefs->GetBoolean(prefs::kWebKitAllowRunningInsecureContent);
- web_prefs.enable_scroll_animator =
- command_line.HasSwitch(switches::kEnableSmoothScrolling);
+
+#if defined(OS_MACOSX)
+ bool default_enable_scroll_animator = true;
+#else
+ // On CrOS, the launcher always passes in the --enable flag.
+ bool default_enable_scroll_animator = false;
+#endif
+ web_prefs.enable_scroll_animator = default_enable_scroll_animator;
+ if (command_line.HasSwitch(switches::kEnableSmoothScrolling))
+ web_prefs.enable_scroll_animator = true;
+ if (command_line.HasSwitch(switches::kDisableSmoothScrolling))
+ web_prefs.enable_scroll_animator = false;
// The user stylesheet watcher may not exist in a testing profile.
if (profile->GetUserStyleSheetWatcher()) {
diff --git a/chrome/test/ui/ppapi_uitest.cc b/chrome/test/ui/ppapi_uitest.cc
index d8bac7c..3ee3a69 100644
--- a/chrome/test/ui/ppapi_uitest.cc
+++ b/chrome/test/ui/ppapi_uitest.cc
@@ -6,6 +6,7 @@
#include "base/path_service.h"
#include "base/test/test_timeouts.h"
#include "build/build_config.h"
+#include "content/common/content_switches.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/test/automation/tab_proxy.h"
#include "chrome/test/ui/ui_test.h"
@@ -55,6 +56,9 @@ class PPAPITest : public UITest {
// TODO(dumi): remove this switch once we have a quota management
// system in place.
launch_arguments_.AppendSwitch(switches::kUnlimitedQuotaForFiles);
+
+ // Smooth scrolling confuses the scrollbar test.
+ launch_arguments_.AppendSwitch(switches::kDisableSmoothScrolling);
}
void RunTest(const std::string& test_case) {
diff --git a/content/common/content_switches.cc b/content/common/content_switches.cc
index 3df8a44..d066fc3 100644
--- a/content/common/content_switches.cc
+++ b/content/common/content_switches.cc
@@ -117,6 +117,9 @@ const char kDisableLocalStorage[] = "disable-local-storage";
// builds.
const char kDisableLogging[] = "disable-logging";
+// Disable smooth scrolling for testing.
+const char kDisableSmoothScrolling[] = "disable-smooth-scrolling";
+
// Prevent plugins from running.
const char kDisablePlugins[] = "disable-plugins";
diff --git a/content/common/content_switches.h b/content/common/content_switches.h
index 31e643c..2d491b3 100644
--- a/content/common/content_switches.h
+++ b/content/common/content_switches.h
@@ -46,6 +46,7 @@ extern const char kDisableJavaScript[];
extern const char kDisableJavaScriptI18NAPI[];
extern const char kDisableLocalStorage[];
extern const char kDisableLogging[];
+extern const char kDisableSmoothScrolling[];
extern const char kDisablePlugins[];
extern const char kDisablePopupBlocking[];
extern const char kDisableRendererAccessibility[];
diff --git a/content/renderer/render_view.h b/content/renderer/render_view.h
index cf90e5e..2df1088 100644
--- a/content/renderer/render_view.h
+++ b/content/renderer/render_view.h
@@ -662,6 +662,7 @@ class RenderView : public RenderWidget,
FRIEND_TEST_ALL_PREFIXES(RenderViewTest, OnImeStateChanged);
FRIEND_TEST_ALL_PREFIXES(RenderViewTest, OnNavStateChanged);
FRIEND_TEST_ALL_PREFIXES(RenderViewTest, OnSetTextDirection);
+ FRIEND_TEST_ALL_PREFIXES(RenderViewTest, OnUpdateWebPreferences);
FRIEND_TEST_ALL_PREFIXES(RenderViewTest, StaleNavigationsIgnored);
FRIEND_TEST_ALL_PREFIXES(RenderViewTest, UpdateTargetURLWithInvalidURL);
#if defined(OS_MACOSX)
diff --git a/content/renderer/render_view_browsertest_mac.mm b/content/renderer/render_view_browsertest_mac.mm
index ca96f00..1d3459b 100644
--- a/content/renderer/render_view_browsertest_mac.mm
+++ b/content/renderer/render_view_browsertest_mac.mm
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -80,6 +80,10 @@ TEST_F(RenderViewTest, MacTestCmdUp) {
);
#undef HTML
+ WebPreferences prefs;
+ prefs.enable_scroll_animator = false;
+ view_->OnUpdateWebPreferences(prefs);
+
const int kMaxOutputCharacters = 1024;
string16 output;
char htmlBuffer[2048];