Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(418)

Side by Side Diff: content/public/test/unittest_test_suite.cc

Issue 290303002: Revert of Use real PlatformSupport in content unit tests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/public/test/unittest_test_suite.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/public/test/unittest_test_suite.h" 5 #include "content/public/test/unittest_test_suite.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/rand_util.h" 8 #include "base/rand_util.h"
9 #include "base/test/test_suite.h" 9 #include "base/test/test_suite.h"
10 #if !defined(OS_IOS) 10 #include "third_party/WebKit/public/platform/Platform.h"
11 #include "content/test/test_webkit_platform_support.h"
12 #endif
13 #include "third_party/WebKit/public/web/WebKit.h" 11 #include "third_party/WebKit/public/web/WebKit.h"
14 12
15 namespace content { 13 namespace content {
16 14
15 #if !defined(OS_IOS)
16 // A stubbed out WebKit platform support impl.
17 class UnitTestTestSuite::UnitTestWebKitPlatformSupport
18 : public blink::Platform {
19 public:
20 UnitTestWebKitPlatformSupport() {}
21 virtual ~UnitTestWebKitPlatformSupport() {}
22 virtual void cryptographicallyRandomValues(unsigned char* buffer,
23 size_t length) OVERRIDE {
24 base::RandBytes(buffer, length);
25 }
26 virtual const unsigned char* getTraceCategoryEnabledFlag(
27 const char* categoryName) {
28 // Causes tracing macros to be disabled.
29 static const unsigned char kEnabled = 0;
30 return &kEnabled;
31 }
32 };
33 #endif // !OS_IOS
34
17 UnitTestTestSuite::UnitTestTestSuite(base::TestSuite* test_suite) 35 UnitTestTestSuite::UnitTestTestSuite(base::TestSuite* test_suite)
18 : test_suite_(test_suite) { 36 : test_suite_(test_suite) {
19 DCHECK(test_suite); 37 DCHECK(test_suite);
20 #if !defined(OS_IOS) 38 #if !defined(OS_IOS)
21 platform_support_.reset(new TestWebKitPlatformSupport); 39 webkit_platform_support_.reset(new UnitTestWebKitPlatformSupport);
40 blink::initialize(webkit_platform_support_.get());
22 #endif 41 #endif
23 } 42 }
24 43
25 UnitTestTestSuite::~UnitTestTestSuite() { 44 UnitTestTestSuite::~UnitTestTestSuite() {
26 #if !defined(OS_IOS) 45 #if !defined(OS_IOS)
27 platform_support_.reset(); 46 blink::shutdown();
28 #endif 47 #endif
29 } 48 }
30 49
31 int UnitTestTestSuite::Run() { 50 int UnitTestTestSuite::Run() {
32 return test_suite_->Run(); 51 return test_suite_->Run();
33 } 52 }
34 53
35 } // namespace content 54 } // namespace content
OLDNEW
« no previous file with comments | « content/public/test/unittest_test_suite.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698