Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(306)

Side by Side Diff: webkit/support/platform_support_android.cc

Issue 18429012: Don't load resources for test (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | webkit/support/platform_support_linux.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_util.h" 8 #include "base/file_util.h"
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 43
44 // Set XML_CATALOG_FILES environment variable to blank to prevent libxml from 44 // Set XML_CATALOG_FILES environment variable to blank to prevent libxml from
45 // loading and complaining the non-exsistent /etc/xml/catalog file. 45 // loading and complaining the non-exsistent /etc/xml/catalog file.
46 setenv("XML_CATALOG_FILES", "", 0); 46 setenv("XML_CATALOG_FILES", "", 0);
47 47
48 JNIEnv* env = base::android::AttachCurrentThread(); 48 JNIEnv* env = base::android::AttachCurrentThread();
49 net::android::RegisterNetworkLibrary(env); 49 net::android::RegisterNetworkLibrary(env);
50 } 50 }
51 51
52 void AfterInitialize() { 52 void AfterInitialize() {
53 base::FilePath data_path(kDumpRenderTreeDir);
54 data_path = data_path.Append("DumpRenderTree.pak");
55 ResourceBundle::InitSharedInstanceWithPakPath(data_path);
56 } 53 }
57 54
58 void BeforeShutdown() { 55 void BeforeShutdown() {
59 ResourceBundle::CleanupSharedInstance();
60 } 56 }
61 57
62 void AfterShutdown() { 58 void AfterShutdown() {
63 } 59 }
64 60
65 } // namespace webkit_support 61 } // namespace webkit_support
66 62
67 base::string16 TestWebKitPlatformSupport::GetLocalizedString(int message_id) {
68 return ResourceBundle::GetSharedInstance().GetLocalizedString(message_id);
69 }
70
71 base::StringPiece TestWebKitPlatformSupport::GetDataResource(
72 int resource_id,
73 ui::ScaleFactor scale_factor) {
74 base::FilePath resources_path(kDumpRenderTreeDir);
75 resources_path = resources_path.Append("DumpRenderTree_resources");
76 switch (resource_id) {
77 case IDR_BROKENIMAGE: {
78 CR_DEFINE_STATIC_LOCAL(std::string, broken_image_data, ());
79 if (broken_image_data.empty()) {
80 base::FilePath path = resources_path.Append("missingImage.gif");
81 bool success = file_util::ReadFileToString(path, &broken_image_data);
82 if (!success)
83 LOG(FATAL) << "Failed reading: " << path.value();
84 }
85 return broken_image_data;
86 }
87 case IDR_TEXTAREA_RESIZER: {
88 CR_DEFINE_STATIC_LOCAL(std::string, resize_corner_data, ());
89 if (resize_corner_data.empty()) {
90 base::FilePath path = resources_path.Append("textAreaResizeCorner.png");
91 bool success = file_util::ReadFileToString(path, &resize_corner_data);
92 if (!success)
93 LOG(FATAL) << "Failed reading: " << path.value();
94 }
95 return resize_corner_data;
96 }
97 }
98
99 return ResourceBundle::GetSharedInstance().GetRawDataResourceForScale(
100 resource_id, scale_factor);
101 }
OLDNEW
« no previous file with comments | « no previous file | webkit/support/platform_support_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698