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 21 matching lines...) Expand all Loading... |
32 | 32 |
33 namespace webkit_support { | 33 namespace webkit_support { |
34 | 34 |
35 void BeforeInitialize(bool unit_test_mode) { | 35 void BeforeInitialize(bool unit_test_mode) { |
36 InitAndroidTestPaths(); | 36 InitAndroidTestPaths(); |
37 | 37 |
38 // Set XML_CATALOG_FILES environment variable to blank to prevent libxml from | 38 // Set XML_CATALOG_FILES environment variable to blank to prevent libxml from |
39 // loading and complaining the non-exsistent /etc/xml/catalog file. | 39 // loading and complaining the non-exsistent /etc/xml/catalog file. |
40 setenv("XML_CATALOG_FILES", "", 0); | 40 setenv("XML_CATALOG_FILES", "", 0); |
41 | 41 |
42 JNIEnv* env = base::android::AttachCurrentThread(); | 42 // For now TestWebKitAPI and webkit_unit_tests are standalone executables |
43 net::android::RegisterNetworkLibrary(env); | 43 // which don't have Java capabilities. Init Java for only DumpRenderTree. |
| 44 if (!unit_test_mode) { |
| 45 JNIEnv* env = base::android::AttachCurrentThread(); |
| 46 net::android::RegisterNetworkLibrary(env); |
| 47 } |
44 } | 48 } |
45 | 49 |
46 void AfterInitialize(bool unit_test_mode) { | 50 void AfterInitialize(bool unit_test_mode) { |
47 if (unit_test_mode) | 51 if (unit_test_mode) |
48 return; // We don't have a resource pack when running the unit-tests. | 52 return; // We don't have a resource pack when running the unit-tests. |
49 | 53 |
50 FilePath data_path(kDumpRenderTreeDir); | 54 FilePath data_path(kDumpRenderTreeDir); |
51 data_path = data_path.Append("DumpRenderTree.pak"); | 55 data_path = data_path.Append("DumpRenderTree.pak"); |
52 ResourceBundle::InitSharedInstanceWithPakFile(data_path); | 56 ResourceBundle::InitSharedInstanceWithPakFile(data_path); |
53 | 57 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 if (!success) | 105 if (!success) |
102 LOG(FATAL) << "Failed reading: " << path.value(); | 106 LOG(FATAL) << "Failed reading: " << path.value(); |
103 } | 107 } |
104 return resize_corner_data; | 108 return resize_corner_data; |
105 } | 109 } |
106 } | 110 } |
107 | 111 |
108 return ResourceBundle::GetSharedInstance().GetRawDataResource( | 112 return ResourceBundle::GetSharedInstance().GetRawDataResource( |
109 resource_id, scale_factor); | 113 resource_id, scale_factor); |
110 } | 114 } |
OLD | NEW |