diff options
Diffstat (limited to 'webkit/tools')
-rw-r--r-- | webkit/tools/test_shell/test_shell_gtk.cc | 27 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_shell_main.cc | 2 |
2 files changed, 6 insertions, 23 deletions
diff --git a/webkit/tools/test_shell/test_shell_gtk.cc b/webkit/tools/test_shell/test_shell_gtk.cc index 9f8ec9d..b94da99 100644 --- a/webkit/tools/test_shell/test_shell_gtk.cc +++ b/webkit/tools/test_shell/test_shell_gtk.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -25,7 +25,7 @@ #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebPoint.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" -#include "ui/base/resource/data_pack.h" +#include "ui/base/resource/resource_bundle.h" #include "webkit/glue/plugins/plugin_list.h" #include "webkit/glue/resource_loader_bridge.h" #include "webkit/glue/webkit_glue.h" @@ -44,9 +44,6 @@ const FcChar8* FilePathAsFcChar(const FilePath& path) { return reinterpret_cast<const FcChar8*>(path.value().c_str()); } -// Data resources on linux. This is a pointer to the mmapped resources file. -ui::DataPack* g_resource_data_pack = NULL; - void TerminationSignalHandler(int signatl) { TestShell::ShutdownTestShell(); exit(0); @@ -159,13 +156,10 @@ void TestShell::InitializeTestShell(bool layout_test_mode, web_prefs_ = new WebPreferences; - g_resource_data_pack = new ui::DataPack; FilePath data_path; PathService::Get(base::DIR_EXE, &data_path); data_path = data_path.Append("test_shell.pak"); - if (!g_resource_data_pack->Load(data_path)) { - LOG(FATAL) << "failed to load test_shell.pak"; - } + ResourceBundle::InitSharedInstanceForTest(data_path); FilePath resources_dir; PathService::Get(base::DIR_SOURCE_ROOT, &resources_dir); @@ -281,8 +275,7 @@ void TestShell::InitializeTestShell(bool layout_test_mode, } void TestShell::PlatformShutdown() { - delete g_resource_data_pack; - g_resource_data_pack = NULL; + ResourceBundle::CleanupSharedInstance(); } void TestShell::PlatformCleanUp() { @@ -563,9 +556,7 @@ void TestShell::ShowStartupDebuggingDialog() { // static base::StringPiece TestShell::ResourceProvider(int key) { - base::StringPiece res; - g_resource_data_pack->GetStringPiece(key, &res); - return res; + return ResourceBundle::GetSharedInstance().GetRawDataResource(key); } //----------------------------------------------------------------------------- @@ -573,13 +564,7 @@ base::StringPiece TestShell::ResourceProvider(int key) { namespace webkit_glue { string16 GetLocalizedString(int message_id) { - base::StringPiece res; - if (!g_resource_data_pack->GetStringPiece(message_id, &res)) { - LOG(FATAL) << "failed to load webkit string with id " << message_id; - } - - return string16(reinterpret_cast<const char16*>(res.data()), - res.length() / 2); + return ResourceBundle::GetSharedInstance().GetLocalizedString(message_id); } base::StringPiece GetDataResource(int resource_id) { diff --git a/webkit/tools/test_shell/test_shell_main.cc b/webkit/tools/test_shell/test_shell_main.cc index 0b26419..49ed62b 100644 --- a/webkit/tools/test_shell/test_shell_main.cc +++ b/webkit/tools/test_shell/test_shell_main.cc @@ -29,7 +29,6 @@ #include "net/url_request/url_request_context.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebScriptController.h" -#include "ui/gfx/gfx_module.h" #include "ui/gfx/gl/gl_implementation.h" #include "ui/gfx/gl/gl_switches.h" #include "webkit/glue/webkit_glue.h" @@ -198,7 +197,6 @@ int main(int argc, char* argv[]) { // Config the modules that need access to a limited set of resources. net::NetModule::SetResourceProvider(TestShell::ResourceProvider); - gfx::GfxModule::SetResourceProvider(TestShell::ResourceProvider); platform.InitializeGUI(); |