summaryrefslogtreecommitdiffstats
path: root/webkit/glue/webkit_glue_unittest.cc
diff options
context:
space:
mode:
authortony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-16 18:45:32 +0000
committertony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-16 18:45:32 +0000
commit5e2cb010a0048a2c0c1495a54c0f8ef8389fd51d (patch)
tree6fde9619cf828c95afe16809cb59c41568b543e2 /webkit/glue/webkit_glue_unittest.cc
parent8b05eabaff391b519bb3c71734338ab1ba934d29 (diff)
downloadchromium_src-5e2cb010a0048a2c0c1495a54c0f8ef8389fd51d.zip
chromium_src-5e2cb010a0048a2c0c1495a54c0f8ef8389fd51d.tar.gz
chromium_src-5e2cb010a0048a2c0c1495a54c0f8ef8389fd51d.tar.bz2
Move tests from test_shell_tests to content_unittests.
These tests don't depend on webkit/tools/test_shell/test_shell_test.h and can be moved to content_unittests. Some tests were relying on the MessageLoop created by TestShell. I've updated them to create their own MessageLoop. BUG=126514 Review URL: https://chromiumcodereview.appspot.com/11883022 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@177180 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue/webkit_glue_unittest.cc')
-rw-r--r--webkit/glue/webkit_glue_unittest.cc27
1 files changed, 22 insertions, 5 deletions
diff --git a/webkit/glue/webkit_glue_unittest.cc b/webkit/glue/webkit_glue_unittest.cc
index fb3a0ef..90fd31f 100644
--- a/webkit/glue/webkit_glue_unittest.cc
+++ b/webkit/glue/webkit_glue_unittest.cc
@@ -10,6 +10,7 @@
#include "base/time.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/skia/include/core/SkBitmap.h"
+#include "third_party/skia/include/core/SkColorPriv.h"
#include "webkit/glue/webkitplatformsupport_impl.h"
namespace {
@@ -33,10 +34,25 @@ TEST(WebkitGlueTest, DecodeImage) {
EXPECT_EQ(2, image.height());
EXPECT_EQ(SkBitmap::kARGB_8888_Config, image.config());
image.lockPixels();
- EXPECT_EQ(SK_ColorBLACK, *image.getAddr32(0, 0));
- EXPECT_EQ(SK_ColorRED, *image.getAddr32(1, 0));
- EXPECT_EQ(SK_ColorGREEN, *image.getAddr32(0, 1));
- EXPECT_EQ(SK_ColorBLUE, *image.getAddr32(1, 1));
+ uint32_t pixel = *image.getAddr32(0, 0); // Black
+ EXPECT_EQ(0x00U, SkGetPackedR32(pixel));
+ EXPECT_EQ(0x00U, SkGetPackedG32(pixel));
+ EXPECT_EQ(0x00U, SkGetPackedB32(pixel));
+
+ pixel = *image.getAddr32(1, 0); // Red
+ EXPECT_EQ(0xffU, SkGetPackedR32(pixel));
+ EXPECT_EQ(0x00U, SkGetPackedG32(pixel));
+ EXPECT_EQ(0x00U, SkGetPackedB32(pixel));
+
+ pixel = *image.getAddr32(0, 1); // Green
+ EXPECT_EQ(0x00U, SkGetPackedR32(pixel));
+ EXPECT_EQ(0xffU, SkGetPackedG32(pixel));
+ EXPECT_EQ(0x00U, SkGetPackedB32(pixel));
+
+ pixel = *image.getAddr32(1, 1); // Blue
+ EXPECT_EQ(0x00U, SkGetPackedR32(pixel));
+ EXPECT_EQ(0x00U, SkGetPackedG32(pixel));
+ EXPECT_EQ(0xffU, SkGetPackedB32(pixel));
image.unlockPixels();
}
@@ -98,6 +114,7 @@ class TestWebKitPlatformSupport
};
TEST(WebkitGlueTest, SuspendResumeSharedTimer) {
+ MessageLoop message_loop;
TestWebKitPlatformSupport platform_support;
// Set a timer to fire as soon as possible.
@@ -106,7 +123,7 @@ TEST(WebkitGlueTest, SuspendResumeSharedTimer) {
platform_support.SuspendSharedTimer();
// The above timer would have posted a task which can be processed out of the
// message loop.
- MessageLoop::current()->RunUntilIdle();
+ message_loop.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);