diff options
author | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-02-22 18:59:39 +0000 |
---|---|---|
committer | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-02-22 18:59:39 +0000 |
commit | f201fb009d970a5a1a260a59af14d00d1bb27ace (patch) | |
tree | 0b9da0b7a4e2339620724366674fb72cef89fd93 /webkit | |
parent | de77773124aee19923ac357bfe1bbf4d9d32e33f (diff) | |
download | chromium_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
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/glue/webkit_glue_unittest.cc | 87 |
1 files changed, 0 insertions, 87 deletions
diff --git a/webkit/glue/webkit_glue_unittest.cc b/webkit/glue/webkit_glue_unittest.cc deleted file mode 100644 index dd8deee..0000000 --- a/webkit/glue/webkit_glue_unittest.cc +++ /dev/null @@ -1,87 +0,0 @@ -// Copyright 2013 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 <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 { - -// Derives WebKitPlatformSupportImpl for testing shared timers. -class TestWebKitPlatformSupport - : public webkit_glue::WebKitPlatformSupportImpl { - public: - TestWebKitPlatformSupport() : mock_monotonically_increasing_time_(0) { - } - - // WebKitPlatformSupportImpl implementation - virtual base::string16 GetLocalizedString(int) OVERRIDE { - return base::string16(); - } - - virtual base::StringPiece GetDataResource(int, ui::ScaleFactor) OVERRIDE { - return base::StringPiece(); - } - - virtual webkit_glue::ResourceLoaderBridge* CreateResourceLoader( - const webkit_glue::ResourceLoaderBridge::RequestInfo&) OVERRIDE { - return NULL; - } - - virtual webkit_glue::WebSocketStreamHandleBridge* CreateWebSocketStreamBridge( - blink::WebSocketStreamHandle*, - webkit_glue::WebSocketStreamHandleDelegate*) OVERRIDE { - return NULL; - } - - // Returns mock time when enabled. - virtual double monotonicallyIncreasingTime() OVERRIDE { - if (mock_monotonically_increasing_time_ > 0.0) - return mock_monotonically_increasing_time_; - return webkit_glue::WebKitPlatformSupportImpl:: - monotonicallyIncreasingTime(); - } - - virtual void OnStartSharedTimer(base::TimeDelta delay) OVERRIDE { - shared_timer_delay_ = 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; - } - - private: - base::TimeDelta shared_timer_delay_; - double mock_monotonically_increasing_time_; -}; - -TEST(WebkitGlueTest, SuspendResumeSharedTimer) { - base::MessageLoop message_loop; - - TestWebKitPlatformSupport platform_support; - - // Set a timer to fire as soon as possible. - platform_support.setSharedTimerFireInterval(0); - // Suspend timers immediately so the above timer wouldn't be fired. - platform_support.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); - // 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()); -} - -} // namespace |