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" |
11 #include "base/path_service.h" | 11 #include "base/path_service.h" |
12 #include "base/string16.h" | 12 #include "base/string16.h" |
13 #include "base/string_piece.h" | 13 #include "base/string_piece.h" |
14 #include "base/test/test_support_android.h" | 14 #include "base/test/test_support_android.h" |
15 #include "googleurl/src/gurl.h" | 15 #include "googleurl/src/gurl.h" |
16 #include "grit/webkit_resources.h" | 16 #include "grit/webkit_resources.h" |
17 #include "net/android/network_library.h" | 17 #include "net/android/network_library.h" |
18 #include "media/base/android/media_player_listener.h" | 18 #include "net/android/net_jni_registrar.h" |
| 19 #include "media/base/android/media_jni_registrar.h" |
19 #include "ui/base/resource/resource_bundle.h" | 20 #include "ui/base/resource/resource_bundle.h" |
20 #include "webkit/support/test_webkit_platform_support.h" | 21 #include "webkit/support/test_webkit_platform_support.h" |
21 #include "webkit/tools/test_shell/simple_resource_loader_bridge.h" | 22 #include "webkit/tools/test_shell/simple_resource_loader_bridge.h" |
22 | 23 |
23 namespace { | 24 namespace { |
24 | 25 |
25 // The place where the Android layout test script will put the required tools | 26 // The place where the Android layout test script will put the required tools |
26 // and resources. Must keep consistent with DEVICE_DRT_DIR in | 27 // and resources. Must keep consistent with DEVICE_DRT_DIR in |
27 // WebKit/Tools/Scripts/webkitpy/layout_tests/port/chromium_android.py. | 28 // WebKit/Tools/Scripts/webkitpy/layout_tests/port/chromium_android.py. |
28 const char kDumpRenderTreeDir[] = "/data/local/tmp/drt"; | 29 const char kDumpRenderTreeDir[] = "/data/local/tmp/drt"; |
(...skipping 10 matching lines...) Expand all Loading... |
39 path = path.Append("cache"); | 40 path = path.Append("cache"); |
40 PathService::Override(base::DIR_CACHE, path); | 41 PathService::Override(base::DIR_CACHE, path); |
41 | 42 |
42 // Set XML_CATALOG_FILES environment variable to blank to prevent libxml from | 43 // Set XML_CATALOG_FILES environment variable to blank to prevent libxml from |
43 // loading and complaining the non-exsistent /etc/xml/catalog file. | 44 // loading and complaining the non-exsistent /etc/xml/catalog file. |
44 setenv("XML_CATALOG_FILES", "", 0); | 45 setenv("XML_CATALOG_FILES", "", 0); |
45 | 46 |
46 JNIEnv* env = base::android::AttachCurrentThread(); | 47 JNIEnv* env = base::android::AttachCurrentThread(); |
47 net::android::RegisterNetworkLibrary(env); | 48 net::android::RegisterNetworkLibrary(env); |
48 | 49 |
49 if (!unit_test_mode) | 50 // Chromium binaries will register their Jni bindings through the library |
50 media::MediaPlayerListener::RegisterMediaPlayerListener(env); | 51 // loader that is part of content/. WebKit uses a different path, so the |
| 52 // bindings have to be initialized separately as well. |
| 53 if (!unit_test_mode) { |
| 54 media::RegisterJni(env); |
| 55 net::android::RegisterJni(env); |
| 56 } |
51 } | 57 } |
52 | 58 |
53 void AfterInitialize(bool unit_test_mode) { | 59 void AfterInitialize(bool unit_test_mode) { |
54 FilePath data_path(kDumpRenderTreeDir); | 60 FilePath data_path(kDumpRenderTreeDir); |
55 data_path = data_path.Append("DumpRenderTree.pak"); | 61 data_path = data_path.Append("DumpRenderTree.pak"); |
56 ResourceBundle::InitSharedInstanceWithPakPath(data_path); | 62 ResourceBundle::InitSharedInstanceWithPakPath(data_path); |
57 | 63 |
58 if (unit_test_mode) | 64 if (unit_test_mode) |
59 return; | 65 return; |
60 | 66 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 if (!success) | 114 if (!success) |
109 LOG(FATAL) << "Failed reading: " << path.value(); | 115 LOG(FATAL) << "Failed reading: " << path.value(); |
110 } | 116 } |
111 return resize_corner_data; | 117 return resize_corner_data; |
112 } | 118 } |
113 } | 119 } |
114 | 120 |
115 return ResourceBundle::GetSharedInstance().GetRawDataResource( | 121 return ResourceBundle::GetSharedInstance().GetRawDataResource( |
116 resource_id, scale_factor); | 122 resource_id, scale_factor); |
117 } | 123 } |
OLD | NEW |