| OLD | NEW |
| 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 "webkit/support/platform_support.h" | 5 #include "webkit/support/platform_support.h" |
| 6 | 6 |
| 7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
| 8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 | 36 |
| 37 // Place cache under kDumpRenderTreeDir to allow the NRWT script to clear it. | 37 // Place cache under kDumpRenderTreeDir to allow the NRWT script to clear it. |
| 38 FilePath path(kDumpRenderTreeDir); | 38 FilePath path(kDumpRenderTreeDir); |
| 39 path = path.Append("cache"); | 39 path = path.Append("cache"); |
| 40 PathService::Override(base::DIR_CACHE, path); | 40 PathService::Override(base::DIR_CACHE, path); |
| 41 | 41 |
| 42 // Set XML_CATALOG_FILES environment variable to blank to prevent libxml from | 42 // Set XML_CATALOG_FILES environment variable to blank to prevent libxml from |
| 43 // loading and complaining the non-exsistent /etc/xml/catalog file. | 43 // loading and complaining the non-exsistent /etc/xml/catalog file. |
| 44 setenv("XML_CATALOG_FILES", "", 0); | 44 setenv("XML_CATALOG_FILES", "", 0); |
| 45 | 45 |
| 46 // For now TestWebKitAPI and webkit_unit_tests are standalone executables | 46 JNIEnv* env = base::android::AttachCurrentThread(); |
| 47 // which don't have Java capabilities. Init Java for only DumpRenderTree. | 47 net::android::RegisterNetworkLibrary(env); |
| 48 if (!unit_test_mode) { | 48 |
| 49 JNIEnv* env = base::android::AttachCurrentThread(); | 49 if (!unit_test_mode) |
| 50 media::MediaPlayerListener::RegisterMediaPlayerListener(env); | 50 media::MediaPlayerListener::RegisterMediaPlayerListener(env); |
| 51 net::android::RegisterNetworkLibrary(env); | |
| 52 } | |
| 53 } | 51 } |
| 54 | 52 |
| 55 void AfterInitialize(bool unit_test_mode) { | 53 void AfterInitialize(bool unit_test_mode) { |
| 56 FilePath data_path(kDumpRenderTreeDir); | 54 FilePath data_path(kDumpRenderTreeDir); |
| 57 data_path = data_path.Append("DumpRenderTree.pak"); | 55 data_path = data_path.Append("DumpRenderTree.pak"); |
| 58 ResourceBundle::InitSharedInstanceWithPakPath(data_path); | 56 ResourceBundle::InitSharedInstanceWithPakPath(data_path); |
| 59 | 57 |
| 60 if (unit_test_mode) | 58 if (unit_test_mode) |
| 61 return; | 59 return; |
| 62 | 60 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 if (!success) | 108 if (!success) |
| 111 LOG(FATAL) << "Failed reading: " << path.value(); | 109 LOG(FATAL) << "Failed reading: " << path.value(); |
| 112 } | 110 } |
| 113 return resize_corner_data; | 111 return resize_corner_data; |
| 114 } | 112 } |
| 115 } | 113 } |
| 116 | 114 |
| 117 return ResourceBundle::GetSharedInstance().GetRawDataResource( | 115 return ResourceBundle::GetSharedInstance().GetRawDataResource( |
| 118 resource_id, scale_factor); | 116 resource_id, scale_factor); |
| 119 } | 117 } |
| OLD | NEW |