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

Side by Side Diff: webkit/tools/test_shell/test_shell_win.cc

Issue 18186: generate test_shell.pak and hook up loading net resources from (Closed)
Patch Set: Created 11 years, 11 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
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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/tools/test_shell/test_shell.h" 5 #include "webkit/tools/test_shell/test_shell.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include <atlbase.h> 8 #include <atlbase.h>
9 #include <commdlg.h> 9 #include <commdlg.h>
10 #include <objbase.h> 10 #include <objbase.h>
11 #include <shlwapi.h> 11 #include <shlwapi.h>
12 #include <wininet.h> // For INTERNET_MAX_URL_LENGTH 12 #include <wininet.h> // For INTERNET_MAX_URL_LENGTH
13 13
14 #include "base/command_line.h" 14 #include "base/command_line.h"
15 #include "base/memory_debug.h" 15 #include "base/memory_debug.h"
16 #include "base/message_loop.h" 16 #include "base/message_loop.h"
17 #include "base/path_service.h" 17 #include "base/path_service.h"
18 #include "base/resource_util.h" 18 #include "base/resource_util.h"
19 #include "base/stack_container.h" 19 #include "base/stack_container.h"
20 #include "base/string_piece.h"
20 #include "base/string_util.h" 21 #include "base/string_util.h"
21 #include "base/trace_event.h" 22 #include "base/trace_event.h"
22 #include "base/win_util.h" 23 #include "base/win_util.h"
23 #include "breakpad/src/client/windows/handler/exception_handler.h" 24 #include "breakpad/src/client/windows/handler/exception_handler.h"
24 #include "net/http/http_network_layer.h" 25 #include "net/http/http_network_layer.h"
25 #include "net/url_request/url_request_file_job.h" 26 #include "net/url_request/url_request_file_job.h"
26 #include "skia/ext/bitmap_platform_device.h" 27 #include "skia/ext/bitmap_platform_device.h"
27 #include "webkit/glue/webdatasource.h" 28 #include "webkit/glue/webdatasource.h"
28 #include "webkit/glue/webframe.h" 29 #include "webkit/glue/webframe.h"
29 #include "webkit/glue/webkit_glue.h" 30 #include "webkit/glue/webkit_glue.h"
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 newPath->append(minidumpID); 105 newPath->append(minidumpID);
105 newPath->append(L".dmp"); 106 newPath->append(L".dmp");
106 107
107 // May use the heap, but oh well. If this fails, we'll just have the 108 // May use the heap, but oh well. If this fails, we'll just have the
108 // original dump file lying around. 109 // original dump file lying around.
109 _wrename(origPath->c_str(), newPath->c_str()); 110 _wrename(origPath->c_str(), newPath->c_str());
110 111
111 return false; 112 return false;
112 } 113 }
113 114
115 StringPiece GetRawDataResource(HMODULE module, int resource_id) {
116 void* data_ptr;
117 size_t data_size;
118 return base::GetDataResourceFromModule(module, resource_id, &data_ptr,
119 &data_size) ?
120 StringPiece(static_cast<char*>(data_ptr), data_size) : StringPiece();
121 }
122
114 } // namespace 123 } // namespace
115 124
116 // Initialize static member variable 125 // Initialize static member variable
117 HINSTANCE TestShell::instance_handle_; 126 HINSTANCE TestShell::instance_handle_;
118 127
119 ///////////////////////////////////////////////////////////////////////////// 128 /////////////////////////////////////////////////////////////////////////////
120 // static methods on TestShell 129 // static methods on TestShell
121 130
122 void TestShell::InitializeTestShell(bool layout_test_mode) { 131 void TestShell::InitializeTestShell(bool layout_test_mode) {
123 // Start COM stuff. 132 // Start COM stuff.
(...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after
683 692
684 result->assign(info.lpstrFile); 693 result->assign(info.lpstrFile);
685 return true; 694 return true;
686 } 695 }
687 696
688 // static 697 // static
689 void TestShell::ShowStartupDebuggingDialog() { 698 void TestShell::ShowStartupDebuggingDialog() {
690 MessageBox(NULL, L"attach to me?", L"test_shell", MB_OK); 699 MessageBox(NULL, L"attach to me?", L"test_shell", MB_OK);
691 } 700 }
692 701
702 // static
703 StringPiece TestShell::NetResourceProvider(int key) {
704 return GetRawDataResource(::GetModuleHandle(NULL), key);
705 }
706
707
693 ///////////////////////////////////////////////////////////////////////////// 708 /////////////////////////////////////////////////////////////////////////////
694 // WebKit glue functions 709 // WebKit glue functions
695 710
696 namespace webkit_glue { 711 namespace webkit_glue {
697 712
698 std::wstring GetLocalizedString(int message_id) { 713 std::wstring GetLocalizedString(int message_id) {
699 const ATLSTRINGRESOURCEIMAGE* image = 714 const ATLSTRINGRESOURCEIMAGE* image =
700 AtlGetStringResourceImage(_AtlBaseModule.GetModuleInstance(), 715 AtlGetStringResourceImage(_AtlBaseModule.GetModuleInstance(),
701 message_id); 716 message_id);
702 if (!image) { 717 if (!image) {
(...skipping 13 matching lines...) Expand all
716 731
717 bool EnsureFontLoaded(HFONT font) { 732 bool EnsureFontLoaded(HFONT font) {
718 return true; 733 return true;
719 } 734 }
720 735
721 bool DownloadUrl(const std::string& url, HWND caller_window) { 736 bool DownloadUrl(const std::string& url, HWND caller_window) {
722 return false; 737 return false;
723 } 738 }
724 739
725 } // namespace webkit_glue 740 } // namespace webkit_glue
OLDNEW
« webkit/tools/test_shell/test_shell_mac.mm ('K') | « webkit/tools/test_shell/test_shell_main.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698