Commit d9dcbd69 authored by enne@chromium.org's avatar enne@chromium.org

Use real PlatformSupport in content unit tests

Once all pages are force composited by default, this allows these tests
to not explode when trying to create GraphicsLayers because of a lack of
Platform::compositorSupport.

BUG=361729

Review URL: https://codereview.chromium.org/287043002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@271794 0039d316-1c4b-4281-b951-d872f2087c98
parent 49ec5dc6
...@@ -30,8 +30,6 @@ ...@@ -30,8 +30,6 @@
'public/test/nested_message_pump_android.cc', 'public/test/nested_message_pump_android.cc',
'public/test/nested_message_pump_android.h', 'public/test/nested_message_pump_android.h',
'test/layouttest_support.cc', 'test/layouttest_support.cc',
'test/mock_webclipboard_impl.cc',
'test/mock_webclipboard_impl.h',
'test/test_media_stream_client.cc', 'test/test_media_stream_client.cc',
'test/test_media_stream_client.h', 'test/test_media_stream_client.h',
'test/test_video_frame_provider.cc', 'test/test_video_frame_provider.cc',
...@@ -175,6 +173,8 @@ ...@@ -175,6 +173,8 @@
'test/mock_keyboard_driver_win.h', 'test/mock_keyboard_driver_win.h',
'test/mock_render_process.cc', 'test/mock_render_process.cc',
'test/mock_render_process.h', 'test/mock_render_process.h',
'test/mock_webclipboard_impl.cc',
'test/mock_webclipboard_impl.h',
'test/mock_webframeclient.h', 'test/mock_webframeclient.h',
'test/mock_weburlloader.cc', 'test/mock_weburlloader.cc',
'test/mock_weburlloader.h', 'test/mock_weburlloader.h',
...@@ -206,8 +206,16 @@ ...@@ -206,8 +206,16 @@
'test/test_render_view_host_factory.h', 'test/test_render_view_host_factory.h',
'test/test_web_contents.cc', 'test/test_web_contents.cc',
'test/test_web_contents.h', 'test/test_web_contents.h',
'test/test_webkit_platform_support.cc',
'test/test_webkit_platform_support.h',
'test/web_gesture_curve_mock.cc', 'test/web_gesture_curve_mock.cc',
'test/web_gesture_curve_mock.h', 'test/web_gesture_curve_mock.h',
'test/webkit_support.cc',
'test/webkit_support.h',
'test/webkit_unit_test_support.cc',
'test/webkit_unit_test_support.h',
'test/web_layer_tree_view_impl_for_testing.cc',
'test/web_layer_tree_view_impl_for_testing.h',
'test/weburl_loader_mock.cc', 'test/weburl_loader_mock.cc',
'test/weburl_loader_mock.h', 'test/weburl_loader_mock.h',
'test/weburl_loader_mock_factory.cc', 'test/weburl_loader_mock_factory.cc',
...@@ -1352,6 +1360,8 @@ ...@@ -1352,6 +1360,8 @@
], ],
}, },
{ {
# TODO(enne): Remove this once dependencies in Blink
# point to test_support_content instead.
'target_name': 'content_webkit_unit_test_support', 'target_name': 'content_webkit_unit_test_support',
'type': 'static_library', 'type': 'static_library',
'dependencies': [ 'dependencies': [
...@@ -1361,16 +1371,6 @@ ...@@ -1361,16 +1371,6 @@
'..', '..',
], ],
'sources': [ 'sources': [
'test/mock_webclipboard_impl.cc',
'test/mock_webclipboard_impl.h',
'test/test_webkit_platform_support.cc',
'test/test_webkit_platform_support.h',
'test/web_layer_tree_view_impl_for_testing.cc',
'test/web_layer_tree_view_impl_for_testing.h',
'test/webkit_support.cc',
'test/webkit_support.h',
'test/webkit_unit_test_support.cc',
'test/webkit_unit_test_support.h',
], ],
}, },
], ],
......
...@@ -7,43 +7,24 @@ ...@@ -7,43 +7,24 @@
#include "base/logging.h" #include "base/logging.h"
#include "base/rand_util.h" #include "base/rand_util.h"
#include "base/test/test_suite.h" #include "base/test/test_suite.h"
#include "third_party/WebKit/public/platform/Platform.h" #if !defined(OS_IOS)
#include "content/test/test_webkit_platform_support.h"
#endif
#include "third_party/WebKit/public/web/WebKit.h" #include "third_party/WebKit/public/web/WebKit.h"
namespace content { namespace content {
#if !defined(OS_IOS)
// A stubbed out WebKit platform support impl.
class UnitTestTestSuite::UnitTestWebKitPlatformSupport
: public blink::Platform {
public:
UnitTestWebKitPlatformSupport() {}
virtual ~UnitTestWebKitPlatformSupport() {}
virtual void cryptographicallyRandomValues(unsigned char* buffer,
size_t length) OVERRIDE {
base::RandBytes(buffer, length);
}
virtual const unsigned char* getTraceCategoryEnabledFlag(
const char* categoryName) {
// Causes tracing macros to be disabled.
static const unsigned char kEnabled = 0;
return &kEnabled;
}
};
#endif // !OS_IOS
UnitTestTestSuite::UnitTestTestSuite(base::TestSuite* test_suite) UnitTestTestSuite::UnitTestTestSuite(base::TestSuite* test_suite)
: test_suite_(test_suite) { : test_suite_(test_suite) {
DCHECK(test_suite); DCHECK(test_suite);
#if !defined(OS_IOS) #if !defined(OS_IOS)
webkit_platform_support_.reset(new UnitTestWebKitPlatformSupport); platform_support_.reset(new TestWebKitPlatformSupport);
blink::initialize(webkit_platform_support_.get());
#endif #endif
} }
UnitTestTestSuite::~UnitTestTestSuite() { UnitTestTestSuite::~UnitTestTestSuite() {
#if !defined(OS_IOS) #if !defined(OS_IOS)
blink::shutdown(); platform_support_.reset();
#endif #endif
} }
......
...@@ -13,6 +13,7 @@ class TestSuite; ...@@ -13,6 +13,7 @@ class TestSuite;
} }
namespace content { namespace content {
class TestWebKitPlatformSupport;
// A special test suite that also initializes WebKit once for all unittests. // A special test suite that also initializes WebKit once for all unittests.
// This is useful for two reasons: // This is useful for two reasons:
...@@ -31,8 +32,7 @@ class UnitTestTestSuite { ...@@ -31,8 +32,7 @@ class UnitTestTestSuite {
scoped_ptr<base::TestSuite> test_suite_; scoped_ptr<base::TestSuite> test_suite_;
#if !defined(OS_IOS) #if !defined(OS_IOS)
class UnitTestWebKitPlatformSupport; scoped_ptr<TestWebKitPlatformSupport> platform_support_;
scoped_ptr<UnitTestWebKitPlatformSupport> webkit_platform_support_;
#endif #endif
DISALLOW_COPY_AND_ASSIGN(UnitTestTestSuite); DISALLOW_COPY_AND_ASSIGN(UnitTestTestSuite);
......
...@@ -2403,3 +2403,59 @@ ...@@ -2403,3 +2403,59 @@
fun:_ZN3gfx31NSImageToSkBitmapWithColorSpaceEP7NSImagebP12CGColorSpace fun:_ZN3gfx31NSImageToSkBitmapWithColorSpaceEP7NSImagebP12CGColorSpace
fun:_ZNK2ui9Clipboard9ReadImageENS_13ClipboardTypeE fun:_ZNK2ui9Clipboard9ReadImageENS_13ClipboardTypeE
} }
{
bug_375391_a
Memcheck:Leak
fun:calloc
fun:_internal_class_createInstanceFromZone
fun:_internal_class_createInstance
fun:NSAllocateObject
fun:+[NSData(NSData) dataWithBytesNoCopy:length:]
fun:-[NSFileManager fileSystemRepresentationWithPath:]
fun:-[NSString(NSPathUtilities) fileSystemRepresentation]
fun:_ZN4base3mac18NSStringToFilePathEP8NSString
fun:_ZN4base10GetTempDirEPNS_8FilePathE
fun:_ZN4base22CreateNewTempDirectoryERKSsPNS_8FilePathE
fun:_ZN4base13ScopedTempDir19CreateUniqueTempDirEv
fun:_ZN7content25TestWebKitPlatformSupportC2Ev
fun:_ZN7content25TestWebKitPlatformSupportC1Ev
fun:_ZN7content17UnitTestTestSuiteC2EPN4base9TestSuiteE
fun:_ZN7content17UnitTestTestSuiteC1EPN4base9TestSuiteE
}
{
bug_375391_b
Memcheck:Leak
fun:malloc_zone_malloc
fun:_CFRuntimeCreateInstance
fun:__CFStringCreateImmutableFunnel3
fun:CFStringCreateWithBytes
fun:-[NSPlaceholderString initWithBytes:length:encoding:]
fun:-[NSString initWithUTF8String:]
fun:NSTemporaryDirectory
fun:_ZN4base10GetTempDirEPNS_8FilePathE
fun:_ZN4base22CreateNewTempDirectoryERKSsPNS_8FilePathE
fun:_ZN4base13ScopedTempDir19CreateUniqueTempDirEv
fun:_ZN7content25TestWebKitPlatformSupportC2Ev
fun:_ZN7content25TestWebKitPlatformSupportC1Ev
fun:_ZN7content17UnitTestTestSuiteC2EPN4base9TestSuiteE
fun:_ZN7content17UnitTestTestSuiteC1EPN4base9TestSuiteE
}
{
bug_375391_c
Memcheck:Leak
fun:calloc
fun:_internal_class_createInstanceFromZone
fun:_internal_class_createInstance
fun:NSAllocateObject
fun:+[NSPathStore2 pathStoreWithCharacters:length:]
fun:-[NSString(NSPathUtilities) _stringByStandardizingPathUsingCache:]
fun:-[NSBundle _initInfoDictionary]
fun:+[NSBundle mainBundle]
fun:_ZN4base3mac11OuterBundleEv
fun:_ZN4base3mac12_GLOBAL__N_118UncachedAmIBundledEv
fun:_ZN4base3mac10AmIBundledEv
fun:_ZN7content25TestWebKitPlatformSupportC2Ev
fun:_ZN7content25TestWebKitPlatformSupportC1Ev
fun:_ZN7content17UnitTestTestSuiteC2EPN4base9TestSuiteE
fun:_ZN7content17UnitTestTestSuiteC1EPN4base9TestSuiteE
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment