| 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_bridge.h" | 18 #include "media/base/android/media_player_listener.h" |
| 19 #include "ui/base/resource/resource_bundle.h" | 19 #include "ui/base/resource/resource_bundle.h" |
| 20 #include "webkit/support/test_webkit_platform_support.h" | 20 #include "webkit/support/test_webkit_platform_support.h" |
| 21 #include "webkit/tools/test_shell/simple_resource_loader_bridge.h" | 21 #include "webkit/tools/test_shell/simple_resource_loader_bridge.h" |
| 22 | 22 |
| 23 namespace { | 23 namespace { |
| 24 | 24 |
| 25 // The place where the Android layout test script will put the required tools | 25 // The place where the Android layout test script will put the required tools |
| 26 // and resources. Must keep consistent with DEVICE_DRT_DIR in | 26 // and resources. Must keep consistent with DEVICE_DRT_DIR in |
| 27 // WebKit/Tools/Scripts/webkitpy/layout_tests/port/chromium_android.py. | 27 // WebKit/Tools/Scripts/webkitpy/layout_tests/port/chromium_android.py. |
| 28 const char kDumpRenderTreeDir[] = "/data/local/tmp/drt"; | 28 const char kDumpRenderTreeDir[] = "/data/local/tmp/drt"; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 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 // For now TestWebKitAPI and webkit_unit_tests are standalone executables |
| 47 // which don't have Java capabilities. Init Java for only DumpRenderTree. | 47 // which don't have Java capabilities. Init Java for only DumpRenderTree. |
| 48 if (!unit_test_mode) { | 48 if (!unit_test_mode) { |
| 49 JNIEnv* env = base::android::AttachCurrentThread(); | 49 JNIEnv* env = base::android::AttachCurrentThread(); |
| 50 media::MediaPlayerBridge::RegisterMediaPlayerListener(env); | 50 media::MediaPlayerListener::RegisterMediaPlayerListener(env); |
| 51 net::android::RegisterNetworkLibrary(env); | 51 net::android::RegisterNetworkLibrary(env); |
| 52 } | 52 } |
| 53 } | 53 } |
| 54 | 54 |
| 55 void AfterInitialize(bool unit_test_mode) { | 55 void AfterInitialize(bool unit_test_mode) { |
| 56 FilePath data_path(kDumpRenderTreeDir); | 56 FilePath data_path(kDumpRenderTreeDir); |
| 57 data_path = data_path.Append("DumpRenderTree.pak"); | 57 data_path = data_path.Append("DumpRenderTree.pak"); |
| 58 ResourceBundle::InitSharedInstanceWithPakPath(data_path); | 58 ResourceBundle::InitSharedInstanceWithPakPath(data_path); |
| 59 | 59 |
| 60 if (unit_test_mode) | 60 if (unit_test_mode) |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 if (!success) | 110 if (!success) |
| 111 LOG(FATAL) << "Failed reading: " << path.value(); | 111 LOG(FATAL) << "Failed reading: " << path.value(); |
| 112 } | 112 } |
| 113 return resize_corner_data; | 113 return resize_corner_data; |
| 114 } | 114 } |
| 115 } | 115 } |
| 116 | 116 |
| 117 return ResourceBundle::GetSharedInstance().GetRawDataResource( | 117 return ResourceBundle::GetSharedInstance().GetRawDataResource( |
| 118 resource_id, scale_factor); | 118 resource_id, scale_factor); |
| 119 } | 119 } |
| OLD | NEW |