Commit 0e44fe2d authored by enne@chromium.org's avatar enne@chromium.org

Revert of Use real PlatformSupport in content unit tests...

Revert of Use real PlatformSupport in content unit tests (https://codereview.chromium.org/287043002/)

Reason for revert:
Caused mac_valgrind issues because TestWebKitPlatformSupport isn't cleaning up after itself properly

Original issue's description:
> 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=none
> 
> Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=270894
> 
> Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=271229

TBR=piman@chromium.org
NOTREECHECKS=true
NOTRY=true
BUG=none

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@271261 0039d316-1c4b-4281-b951-d872f2087c98
parent 95a2e410
......@@ -30,6 +30,8 @@
'public/test/nested_message_pump_android.cc',
'public/test/nested_message_pump_android.h',
'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.h',
'test/test_video_frame_provider.cc',
......@@ -173,8 +175,6 @@
'test/mock_keyboard_driver_win.h',
'test/mock_render_process.cc',
'test/mock_render_process.h',
'test/mock_webclipboard_impl.cc',
'test/mock_webclipboard_impl.h',
'test/mock_webframeclient.h',
'test/mock_weburlloader.cc',
'test/mock_weburlloader.h',
......@@ -206,16 +206,8 @@
'test/test_render_view_host_factory.h',
'test/test_web_contents.cc',
'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.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.h',
'test/weburl_loader_mock_factory.cc',
......@@ -1358,8 +1350,6 @@
],
},
{
# TODO(enne): Remove this once dependencies in Blink
# point to test_support_content instead.
'target_name': 'content_webkit_unit_test_support',
'type': 'static_library',
'dependencies': [
......@@ -1369,6 +1359,16 @@
'..',
],
'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,24 +7,43 @@
#include "base/logging.h"
#include "base/rand_util.h"
#include "base/test/test_suite.h"
#if !defined(OS_IOS)
#include "content/test/test_webkit_platform_support.h"
#endif
#include "third_party/WebKit/public/platform/Platform.h"
#include "third_party/WebKit/public/web/WebKit.h"
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)
: test_suite_(test_suite) {
DCHECK(test_suite);
#if !defined(OS_IOS)
platform_support_.reset(new TestWebKitPlatformSupport);
webkit_platform_support_.reset(new UnitTestWebKitPlatformSupport);
blink::initialize(webkit_platform_support_.get());
#endif
}
UnitTestTestSuite::~UnitTestTestSuite() {
#if !defined(OS_IOS)
platform_support_.reset();
blink::shutdown();
#endif
}
......
......@@ -13,7 +13,6 @@ class TestSuite;
}
namespace content {
class TestWebKitPlatformSupport;
// A special test suite that also initializes WebKit once for all unittests.
// This is useful for two reasons:
......@@ -32,7 +31,8 @@ class UnitTestTestSuite {
scoped_ptr<base::TestSuite> test_suite_;
#if !defined(OS_IOS)
scoped_ptr<TestWebKitPlatformSupport> platform_support_;
class UnitTestWebKitPlatformSupport;
scoped_ptr<UnitTestWebKitPlatformSupport> webkit_platform_support_;
#endif
DISALLOW_COPY_AND_ASSIGN(UnitTestTestSuite);
......
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