OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/test/webkit_support.h" | 5 #include "content/test/webkit_support.h" |
6 | 6 |
7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
9 #include "content/test/test_webkit_platform_support.h" | 9 #include "content/test/test_webkit_platform_support.h" |
10 #include "third_party/WebKit/public/web/WebCache.h" | 10 #include "third_party/WebKit/public/web/WebCache.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 private: | 50 private: |
51 scoped_ptr<MessageLoopType> main_message_loop_; | 51 scoped_ptr<MessageLoopType> main_message_loop_; |
52 scoped_ptr<TestWebKitPlatformSupport> webkit_platform_support_; | 52 scoped_ptr<TestWebKitPlatformSupport> webkit_platform_support_; |
53 }; | 53 }; |
54 | 54 |
55 TestEnvironment* test_environment; | 55 TestEnvironment* test_environment; |
56 | 56 |
57 } // namespace | 57 } // namespace |
58 | 58 |
59 void SetUpTestEnvironmentForUnitTests() { | 59 void SetUpTestEnvironmentForUnitTests() { |
60 WebKit::WebRuntimeFeatures::enableStableFeatures(true); | 60 blink::WebRuntimeFeatures::enableStableFeatures(true); |
61 WebKit::WebRuntimeFeatures::enableExperimentalFeatures(true); | 61 blink::WebRuntimeFeatures::enableExperimentalFeatures(true); |
62 WebKit::WebRuntimeFeatures::enableTestOnlyFeatures(true); | 62 blink::WebRuntimeFeatures::enableTestOnlyFeatures(true); |
63 | 63 |
64 #if defined(OS_ANDROID) | 64 #if defined(OS_ANDROID) |
65 JNIEnv* env = base::android::AttachCurrentThread(); | 65 JNIEnv* env = base::android::AttachCurrentThread(); |
66 net::android::RegisterNetworkLibrary(env); | 66 net::android::RegisterNetworkLibrary(env); |
67 #endif | 67 #endif |
68 | 68 |
69 #if defined(OS_MACOSX) | 69 #if defined(OS_MACOSX) |
70 mock_cr_app::RegisterMockCrApp(); | 70 mock_cr_app::RegisterMockCrApp(); |
71 #endif | 71 #endif |
72 | 72 |
73 // Explicitly initialize the GURL library before spawning any threads. | 73 // Explicitly initialize the GURL library before spawning any threads. |
74 // Otherwise crash may happend when different threads try to create a GURL | 74 // Otherwise crash may happend when different threads try to create a GURL |
75 // at same time. | 75 // at same time. |
76 url_util::Initialize(); | 76 url_util::Initialize(); |
77 test_environment = new TestEnvironment; | 77 test_environment = new TestEnvironment; |
78 webkit_glue::SetUserAgent(webkit_glue::BuildUserAgentFromProduct( | 78 webkit_glue::SetUserAgent(webkit_glue::BuildUserAgentFromProduct( |
79 "DumpRenderTree/0.0.0.0"), false); | 79 "DumpRenderTree/0.0.0.0"), false); |
80 } | 80 } |
81 | 81 |
82 void TearDownTestEnvironment() { | 82 void TearDownTestEnvironment() { |
83 // Flush any remaining messages before we kill ourselves. | 83 // Flush any remaining messages before we kill ourselves. |
84 // http://code.google.com/p/chromium/issues/detail?id=9500 | 84 // http://code.google.com/p/chromium/issues/detail?id=9500 |
85 base::RunLoop().RunUntilIdle(); | 85 base::RunLoop().RunUntilIdle(); |
86 | 86 |
87 if (RunningOnValgrind()) | 87 if (RunningOnValgrind()) |
88 WebKit::WebCache::clear(); | 88 blink::WebCache::clear(); |
89 delete test_environment; | 89 delete test_environment; |
90 test_environment = NULL; | 90 test_environment = NULL; |
91 } | 91 } |
92 | 92 |
93 } // namespace content | 93 } // namespace content |
OLD | NEW |