summaryrefslogtreecommitdiffstats
path: root/webkit/glue
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
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')
-rw-r--r--webkit/glue/resource_request_body_unittest.cc3
-rw-r--r--webkit/glue/webcursor_unittest.cc3
-rw-r--r--webkit/glue/webkit_glue_unittest.cc27
3 files changed, 26 insertions, 7 deletions
diff --git a/webkit/glue/resource_request_body_unittest.cc b/webkit/glue/resource_request_body_unittest.cc
index fe0c136..62c5d70 100644
--- a/webkit/glue/resource_request_body_unittest.cc
+++ b/webkit/glue/resource_request_body_unittest.cc
@@ -8,6 +8,7 @@
#include "base/file_path.h"
#include "base/file_util.h"
+#include "base/message_loop.h"
#include "base/message_loop_proxy.h"
#include "base/time.h"
#include "googleurl/src/gurl.h"
@@ -54,6 +55,7 @@ bool AreElementsEqual(const net::UploadElementReader& reader,
} // namespace
TEST(ResourceRequestBodyTest, CreateUploadDataStreamWithoutBlob) {
+ MessageLoop message_loop;
scoped_refptr<ResourceRequestBody> request_body = new ResourceRequestBody;
const char kData[] = "123";
@@ -90,6 +92,7 @@ TEST(ResourceRequestBodyTest, CreateUploadDataStreamWithoutBlob) {
}
TEST(ResourceRequestBodyTest, ResolveBlobAndCreateUploadDataStream) {
+ MessageLoop message_loop;
// Setup blob data for testing.
base::Time time1, time2;
base::Time::FromString("Tue, 15 Nov 1994, 12:45:26 GMT", &time1);
diff --git a/webkit/glue/webcursor_unittest.cc b/webkit/glue/webcursor_unittest.cc
index 27fc5c8..4ee0cd7 100644
--- a/webkit/glue/webcursor_unittest.cc
+++ b/webkit/glue/webcursor_unittest.cc
@@ -6,7 +6,6 @@
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebCursorInfo.h"
#include "webkit/glue/webcursor.h"
-#include "webkit/tools/test_shell/test_shell_test.h"
using WebKit::WebCursorInfo;
@@ -135,7 +134,7 @@ TEST(WebCursorTest, BrokenCursorSerialization) {
EXPECT_FALSE(custom_cursor.Deserialize(&iter));
}
-#if defined(OS_WIN)
+#if defined(OS_WIN) && !defined(USE_AURA)
TEST(WebCursorTest, WindowsCursorConversion) {
WebCursor custom_cursor;
Pickle win32_custom_pickle;
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);