summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-22 18:59:39 +0000
committertfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-22 18:59:39 +0000
commitf201fb009d970a5a1a260a59af14d00d1bb27ace (patch)
tree0b9da0b7a4e2339620724366674fb72cef89fd93
parentde77773124aee19923ac357bfe1bbf4d9d32e33f (diff)
downloadchromium_src-f201fb009d970a5a1a260a59af14d00d1bb27ace.zip
chromium_src-f201fb009d970a5a1a260a59af14d00d1bb27ace.tar.gz
chromium_src-f201fb009d970a5a1a260a59af14d00d1bb27ace.tar.bz2
Move webkit_glue_unittest.cc from webkit to content/child.
This unit test is already in content_unittests target and with the removal of src/webkit we need to move it over to content/. BUG=265753 TEST=content_unittests --gtest_filter=BlinkPlatformTest.* R=avi@chromium.org TBR=darin Review URL: https://codereview.chromium.org/175363004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@252812 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--content/child/blink_platform_unittest.cc (renamed from webkit/glue/webkit_glue_unittest.cc)39
-rw-r--r--content/content_tests.gypi2
2 files changed, 21 insertions, 20 deletions
diff --git a/webkit/glue/webkit_glue_unittest.cc b/content/child/blink_platform_unittest.cc
index dd8deee..acd049c 100644
--- a/webkit/glue/webkit_glue_unittest.cc
+++ b/content/child/blink_platform_unittest.cc
@@ -2,23 +2,19 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include <string>
-
#include "base/run_loop.h"
#include "base/time/time.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "webkit/child/webkitplatformsupport_impl.h"
-namespace {
+namespace content {
// Derives WebKitPlatformSupportImpl for testing shared timers.
-class TestWebKitPlatformSupport
- : public webkit_glue::WebKitPlatformSupportImpl {
+class TestBlinkPlatformImpl : public webkit_glue::WebKitPlatformSupportImpl {
public:
- TestWebKitPlatformSupport() : mock_monotonically_increasing_time_(0) {
- }
+ TestBlinkPlatformImpl() : mock_monotonically_increasing_time_(0) {}
- // WebKitPlatformSupportImpl implementation
+ // webkit_glue::WebKitPlatformSupportImpl:
virtual base::string16 GetLocalizedString(int) OVERRIDE {
return base::string16();
}
@@ -50,9 +46,7 @@ class TestWebKitPlatformSupport
shared_timer_delay_ = delay;
}
- base::TimeDelta shared_timer_delay() {
- return shared_timer_delay_;
- }
+ base::TimeDelta shared_timer_delay() { return shared_timer_delay_; }
void set_mock_monotonically_increasing_time(double mock_time) {
mock_monotonically_increasing_time_ = mock_time;
@@ -61,27 +55,34 @@ class TestWebKitPlatformSupport
private:
base::TimeDelta shared_timer_delay_;
double mock_monotonically_increasing_time_;
+
+ DISALLOW_COPY_AND_ASSIGN(TestBlinkPlatformImpl);
};
-TEST(WebkitGlueTest, SuspendResumeSharedTimer) {
+TEST(BlinkPlatformTest, SuspendResumeSharedTimer) {
base::MessageLoop message_loop;
- TestWebKitPlatformSupport platform_support;
+ TestBlinkPlatformImpl platform_impl;
// Set a timer to fire as soon as possible.
- platform_support.setSharedTimerFireInterval(0);
+ platform_impl.setSharedTimerFireInterval(0);
+
// Suspend timers immediately so the above timer wouldn't be fired.
- platform_support.SuspendSharedTimer();
+ platform_impl.SuspendSharedTimer();
+
// The above timer would have posted a task which can be processed out of the
// message loop.
base::RunLoop().RunUntilIdle();
+
// Set a mock time after 1 second to simulate timers suspended for 1 second.
double new_time = base::Time::Now().ToDoubleT() + 1;
- platform_support.set_mock_monotonically_increasing_time(new_time);
+ platform_impl.set_mock_monotonically_increasing_time(new_time);
+
// Resume timers so that the timer set above will be set again to fire
// immediately.
- platform_support.ResumeSharedTimer();
- EXPECT_TRUE(base::TimeDelta() == platform_support.shared_timer_delay());
+ platform_impl.ResumeSharedTimer();
+
+ EXPECT_TRUE(base::TimeDelta() == platform_impl.shared_timer_delay());
}
-} // namespace
+} // namespace content
diff --git a/content/content_tests.gypi b/content/content_tests.gypi
index db64b35..88e1064 100644
--- a/content/content_tests.gypi
+++ b/content/content_tests.gypi
@@ -509,6 +509,7 @@
'browser/web_contents/web_drag_source_mac_unittest.mm',
'browser/webui/web_ui_data_source_unittest.cc',
'browser/webui/web_ui_message_handler_unittest.cc',
+ 'child/blink_platform_unittest.cc',
'child/fileapi/webfilewriter_base_unittest.cc',
'child/indexed_db/indexed_db_dispatcher_unittest.cc',
'child/indexed_db/webidbcursor_impl_unittest.cc',
@@ -631,7 +632,6 @@
'../webkit/common/database/database_connections_unittest.cc',
'../webkit/common/database/database_identifier_unittest.cc',
'../webkit/common/fileapi/file_system_util_unittest.cc',
- '../webkit/glue/webkit_glue_unittest.cc',
'../webkit/common/user_agent/user_agent_unittest.cc',
'../webkit/browser/quota/mock_quota_manager.cc',
'../webkit/browser/quota/mock_quota_manager.h',