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

Side by Side Diff: cc/test/run_all_unittests.cc

Issue 10918281: Enable webkit_compositor_bindings_unittests in component builds (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 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 | « cc/cc_tests.gyp ('k') | cc/test/test_webkit_platform.h » ('j') | 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 "base/message_loop.h" 5 #include "base/message_loop.h"
6 #include "base/rand_util.h"
7 #include "base/threading/thread_local_storage.h"
8 #include "base/test/test_suite.h" 6 #include "base/test/test_suite.h"
7 #include "cc/test/test_webkit_platform.h"
9 #include "third_party/WebKit/Source/Platform/chromium/public/Platform.h" 8 #include "third_party/WebKit/Source/Platform/chromium/public/Platform.h"
10 #include "webkit/compositor_bindings/web_compositor_support_impl.h"
11 #include "webkit/glue/webthread_impl.h"
12 #include <gmock/gmock.h> 9 #include <gmock/gmock.h>
13 10
14 #include "base/debug/trace_event_impl.h"
15
16 using webkit_glue::WebThreadImplForMessageLoop;
17
18 class TestPlatform : public WebKit::Platform {
19 public:
20 virtual WebKit::WebCompositorSupport* compositorSupport() {
21 return &compositor_support_;
22 }
23
24 virtual void cryptographicallyRandomValues(
25 unsigned char* buffer, size_t length) {
26 base::RandBytes(buffer, length);
27 }
28
29 virtual WebKit::WebThread* createThread(const char* name) {
30 return new webkit_glue::WebThreadImpl(name);
31 }
32
33 virtual WebKit::WebThread* currentThread() {
34 webkit_glue::WebThreadImplForMessageLoop* thread =
35 static_cast<WebThreadImplForMessageLoop*>(current_thread_slot_.Get());
36 if (thread)
37 return (thread);
38
39 scoped_refptr<base::MessageLoopProxy> message_loop =
40 base::MessageLoopProxy::current();
41 if (!message_loop)
42 return NULL;
43
44 thread = new WebThreadImplForMessageLoop(message_loop);
45 current_thread_slot_.Set(thread);
46 return thread;
47 }
48
49 virtual double currentTime() {
50 return base::Time::Now().ToDoubleT();
51 }
52
53 virtual double monotonicallyIncreasingTime() {
54 return base::TimeTicks::Now().ToInternalValue() /
55 static_cast<double>(base::Time::kMicrosecondsPerSecond);
56 }
57
58 private:
59 base::ThreadLocalStorage::Slot current_thread_slot_;
60 webkit::WebCompositorSupportImpl compositor_support_;
61 };
62
63 int main(int argc, char** argv) { 11 int main(int argc, char** argv) {
64 ::testing::InitGoogleMock(&argc, argv); 12 ::testing::InitGoogleMock(&argc, argv);
65 TestSuite testSuite(argc, argv); 13 TestSuite testSuite(argc, argv);
66 TestPlatform platform; 14 cc::TestWebKitPlatform platform;
67 MessageLoop message_loop; 15 MessageLoop message_loop;
68 WebKit::Platform::initialize(&platform); 16 WebKit::Platform::initialize(&platform);
69 int result = testSuite.Run(); 17 int result = testSuite.Run();
70 WebKit::Platform::shutdown(); 18 WebKit::Platform::shutdown();
71 19
72 return result; 20 return result;
73 } 21 }
74 22
OLDNEW
« no previous file with comments | « cc/cc_tests.gyp ('k') | cc/test/test_webkit_platform.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698