| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/blink_test_environment.h" | 5 #include "content/test/blink_test_environment.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| 11 #include "base/run_loop.h" | 11 #include "base/run_loop.h" |
| 12 #include "base/strings/string_tokenizer.h" | 12 #include "base/strings/string_tokenizer.h" |
| 13 #include "base/third_party/dynamic_annotations/dynamic_annotations.h" | 13 #include "base/third_party/dynamic_annotations/dynamic_annotations.h" |
| 14 #include "content/public/common/content_switches.h" | 14 #include "content/public/common/content_switches.h" |
| 15 #include "content/public/common/user_agent.h" | 15 #include "content/public/common/user_agent.h" |
| 16 #include "content/public/test/test_content_client_initializer.h" | 16 #include "content/public/test/test_content_client_initializer.h" |
| 17 #include "content/test/test_blink_web_unit_test_support.h" | 17 #include "content/test/test_blink_web_unit_test_support.h" |
| 18 #include "third_party/WebKit/public/web/WebCache.h" | 18 #include "third_party/WebKit/public/web/WebCache.h" |
| 19 #include "third_party/WebKit/public/web/WebKit.h" | 19 #include "third_party/WebKit/public/web/WebKit.h" |
| 20 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" | 20 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" |
| 21 #include "ui/gfx/dpi.h" |
| 21 #include "url/url_util.h" | 22 #include "url/url_util.h" |
| 22 | 23 |
| 23 #if defined(OS_WIN) | |
| 24 #include "ui/gfx/win/dpi.h" | |
| 25 #endif | |
| 26 | |
| 27 #if defined(OS_ANDROID) | 24 #if defined(OS_ANDROID) |
| 28 #include "base/android/jni_android.h" | 25 #include "base/android/jni_android.h" |
| 29 #include "net/android/network_library.h" | 26 #include "net/android/network_library.h" |
| 30 #endif | 27 #endif |
| 31 | 28 |
| 32 #if defined(OS_MACOSX) | 29 #if defined(OS_MACOSX) |
| 33 #include "base/test/mock_chrome_application_mac.h" | 30 #include "base/test/mock_chrome_application_mac.h" |
| 34 #endif | 31 #endif |
| 35 | 32 |
| 36 namespace content { | 33 namespace content { |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 | 90 |
| 94 #if defined(OS_ANDROID) | 91 #if defined(OS_ANDROID) |
| 95 JNIEnv* env = base::android::AttachCurrentThread(); | 92 JNIEnv* env = base::android::AttachCurrentThread(); |
| 96 net::android::RegisterNetworkLibrary(env); | 93 net::android::RegisterNetworkLibrary(env); |
| 97 #endif | 94 #endif |
| 98 | 95 |
| 99 #if defined(OS_MACOSX) | 96 #if defined(OS_MACOSX) |
| 100 mock_cr_app::RegisterMockCrApp(); | 97 mock_cr_app::RegisterMockCrApp(); |
| 101 #endif | 98 #endif |
| 102 | 99 |
| 103 #if defined(OS_WIN) | 100 #if defined(OS_WIN) || (defined(OS_LINUX) && !defined(OS_CHROMEOS)) |
| 104 gfx::InitDeviceScaleFactor(1.0f); | 101 gfx::InitDeviceScaleFactor(1.0f); |
| 105 #endif | 102 #endif |
| 106 | 103 |
| 107 // Explicitly initialize the GURL library before spawning any threads. | 104 // Explicitly initialize the GURL library before spawning any threads. |
| 108 // Otherwise crash may happend when different threads try to create a GURL | 105 // Otherwise crash may happend when different threads try to create a GURL |
| 109 // at same time. | 106 // at same time. |
| 110 url::Initialize(); | 107 url::Initialize(); |
| 111 test_environment = new TestEnvironment; | 108 test_environment = new TestEnvironment; |
| 112 } | 109 } |
| 113 | 110 |
| 114 void TearDownBlinkTestEnvironment() { | 111 void TearDownBlinkTestEnvironment() { |
| 115 // Flush any remaining messages before we kill ourselves. | 112 // Flush any remaining messages before we kill ourselves. |
| 116 // http://code.google.com/p/chromium/issues/detail?id=9500 | 113 // http://code.google.com/p/chromium/issues/detail?id=9500 |
| 117 base::RunLoop().RunUntilIdle(); | 114 base::RunLoop().RunUntilIdle(); |
| 118 | 115 |
| 119 if (RunningOnValgrind()) | 116 if (RunningOnValgrind()) |
| 120 blink::WebCache::clear(); | 117 blink::WebCache::clear(); |
| 121 delete test_environment; | 118 delete test_environment; |
| 122 test_environment = NULL; | 119 test_environment = NULL; |
| 123 } | 120 } |
| 124 | 121 |
| 125 } // namespace content | 122 } // namespace content |
| OLD | NEW |