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

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

Issue 13219005: Replace string16 with base::string16 in src/webkit (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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 | Annotate | Revision Log
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/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 <commdlg.h> 8 #include <commdlg.h>
9 #include <objbase.h> 9 #include <objbase.h>
10 #include <process.h> 10 #include <process.h>
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 void* font_ptr; 171 void* font_ptr;
172 size_t font_size; 172 size_t font_size;
173 if (base::win::GetDataResourceFromModule(::GetModuleHandle(NULL), 173 if (base::win::GetDataResourceFromModule(::GetModuleHandle(NULL),
174 IDR_AHEM_FONT, &font_ptr, &font_size)) { 174 IDR_AHEM_FONT, &font_ptr, &font_size)) {
175 HANDLE rc = AddFontMemResourceEx(font_ptr, font_size, 0, &num_fonts); 175 HANDLE rc = AddFontMemResourceEx(font_ptr, font_size, 0, &num_fonts);
176 DCHECK(rc != 0); 176 DCHECK(rc != 0);
177 } 177 }
178 178
179 const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess(); 179 const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess();
180 if (parsed_command_line.HasSwitch(test_shell::kCrashDumps)) { 180 if (parsed_command_line.HasSwitch(test_shell::kCrashDumps)) {
181 string16 dir( 181 base::string16 dir(
182 parsed_command_line.GetSwitchValueNative(test_shell::kCrashDumps)); 182 parsed_command_line.GetSwitchValueNative(test_shell::kCrashDumps));
183 if (parsed_command_line.HasSwitch(test_shell::kCrashDumpsFulldump)) { 183 if (parsed_command_line.HasSwitch(test_shell::kCrashDumpsFulldump)) {
184 new google_breakpad::ExceptionHandler( 184 new google_breakpad::ExceptionHandler(
185 dir, // dump_path 185 dir, // dump_path
186 NULL, // filter 186 NULL, // filter
187 &MinidumpCallback, // callback 187 &MinidumpCallback, // callback
188 NULL, // callback_context 188 NULL, // callback_context
189 google_breakpad::ExceptionHandler::HANDLER_ALL, // handler_types 189 google_breakpad::ExceptionHandler::HANDLER_ALL, // handler_types
190 kFullDumpType, // dump_type 190 kFullDumpType, // dump_type
191 static_cast<const wchar_t*>(NULL), // pipe_name 191 static_cast<const wchar_t*>(NULL), // pipe_name
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 LoadIcon(instance_handle_, MAKEINTRESOURCE(IDI_TESTSHELL)), 226 LoadIcon(instance_handle_, MAKEINTRESOURCE(IDI_TESTSHELL)),
227 LoadCursor(NULL, IDC_ARROW), 227 LoadCursor(NULL, IDC_ARROW),
228 0, 228 0,
229 MAKEINTRESOURCE(IDC_TESTSHELL), 229 MAKEINTRESOURCE(IDC_TESTSHELL),
230 g_windowClass, 230 g_windowClass,
231 LoadIcon(instance_handle_, MAKEINTRESOURCE(IDI_SMALL)), 231 LoadIcon(instance_handle_, MAKEINTRESOURCE(IDI_SMALL)),
232 }; 232 };
233 return RegisterClassEx(&wcex); 233 return RegisterClassEx(&wcex);
234 } 234 }
235 235
236 void TestShell::DumpAllBackForwardLists(string16* result) { 236 void TestShell::DumpAllBackForwardLists(base::string16* result) {
237 result->clear(); 237 result->clear();
238 for (WindowList::iterator iter = TestShell::windowList()->begin(); 238 for (WindowList::iterator iter = TestShell::windowList()->begin();
239 iter != TestShell::windowList()->end(); iter++) { 239 iter != TestShell::windowList()->end(); iter++) {
240 HWND hwnd = *iter; 240 HWND hwnd = *iter;
241 TestShell* shell = 241 TestShell* shell =
242 static_cast<TestShell*>(ui::GetWindowUserData(hwnd)); 242 static_cast<TestShell*>(ui::GetWindowUserData(hwnd));
243 shell->DumpBackForwardList(result); 243 shell->DumpBackForwardList(result);
244 } 244 }
245 } 245 }
246 246
247 std::string TestShell::RewriteLocalUrl(const std::string& url) { 247 std::string TestShell::RewriteLocalUrl(const std::string& url) {
248 // Convert file:///tmp/LayoutTests urls to the actual location on disk. 248 // Convert file:///tmp/LayoutTests urls to the actual location on disk.
249 const char kPrefix[] = "file:///tmp/LayoutTests/"; 249 const char kPrefix[] = "file:///tmp/LayoutTests/";
250 const int kPrefixLen = arraysize(kPrefix) - 1; 250 const int kPrefixLen = arraysize(kPrefix) - 1;
251 251
252 std::string new_url(url); 252 std::string new_url(url);
253 if (url.compare(0, kPrefixLen, kPrefix, kPrefixLen) == 0) { 253 if (url.compare(0, kPrefixLen, kPrefix, kPrefixLen) == 0) {
254 base::FilePath replace_url; 254 base::FilePath replace_url;
255 PathService::Get(base::DIR_EXE, &replace_url); 255 PathService::Get(base::DIR_EXE, &replace_url);
256 replace_url = replace_url.DirName(); 256 replace_url = replace_url.DirName();
257 replace_url = replace_url.DirName(); 257 replace_url = replace_url.DirName();
258 replace_url = replace_url.AppendASCII("third_party"); 258 replace_url = replace_url.AppendASCII("third_party");
259 replace_url = replace_url.AppendASCII("WebKit"); 259 replace_url = replace_url.AppendASCII("WebKit");
260 replace_url = replace_url.AppendASCII("LayoutTests"); 260 replace_url = replace_url.AppendASCII("LayoutTests");
261 string16 replace_url_str = replace_url.value(); 261 base::string16 replace_url_str = replace_url.value();
262 replace_url_str.push_back(L'/'); 262 replace_url_str.push_back(L'/');
263 new_url = std::string("file:///") + 263 new_url = std::string("file:///") +
264 UTF16ToUTF8(replace_url_str).append(url.substr(kPrefixLen)); 264 UTF16ToUTF8(replace_url_str).append(url.substr(kPrefixLen));
265 } 265 }
266 return new_url; 266 return new_url;
267 } 267 }
268 268
269 269
270 270
271 ///////////////////////////////////////////////////////////////////////////// 271 /////////////////////////////////////////////////////////////////////////////
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 GetClientRect(m_mainWnd, &rc); 479 GetClientRect(m_mainWnd, &rc);
480 480
481 int x = BUTTON_WIDTH * 4; 481 int x = BUTTON_WIDTH * 4;
482 MoveWindow(m_editWnd, x, 0, rc.right - x, URLBAR_HEIGHT, TRUE); 482 MoveWindow(m_editWnd, x, 0, rc.right - x, URLBAR_HEIGHT, TRUE);
483 483
484 MoveWindow(webViewWnd(), 0, URLBAR_HEIGHT, rc.right, 484 MoveWindow(webViewWnd(), 0, URLBAR_HEIGHT, rc.right,
485 rc.bottom - URLBAR_HEIGHT, TRUE); 485 rc.bottom - URLBAR_HEIGHT, TRUE);
486 } 486 }
487 487
488 void TestShell::LoadURLForFrame(const GURL& url, 488 void TestShell::LoadURLForFrame(const GURL& url,
489 const string16& frame_name) { 489 const base::string16& frame_name) {
490 if (!url.is_valid()) 490 if (!url.is_valid())
491 return; 491 return;
492 492
493 TRACE_EVENT_BEGIN_ETW("url.load", this, url.spec()); 493 TRACE_EVENT_BEGIN_ETW("url.load", this, url.spec());
494 494
495 if (IsSVGTestURL(url)) { 495 if (IsSVGTestURL(url)) {
496 SizeToSVG(); 496 SizeToSVG();
497 } else { 497 } else {
498 // only resize back to the default when running tests 498 // only resize back to the default when running tests
499 if (layout_test_mode()) 499 if (layout_test_mode())
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
662 void TestShell::ShowStartupDebuggingDialog() { 662 void TestShell::ShowStartupDebuggingDialog() {
663 MessageBox(NULL, L"attach to me?", L"test_shell", MB_OK); 663 MessageBox(NULL, L"attach to me?", L"test_shell", MB_OK);
664 } 664 }
665 665
666 // static 666 // static
667 base::StringPiece TestShell::ResourceProvider(int key) { 667 base::StringPiece TestShell::ResourceProvider(int key) {
668 return GetRawDataResource(::GetModuleHandle(NULL), key); 668 return GetRawDataResource(::GetModuleHandle(NULL), key);
669 } 669 }
670 670
671 671
672 string16 TestShellWebKitInit::GetLocalizedString(int message_id) { 672 base::string16 TestShellWebKitInit::GetLocalizedString(int message_id) {
673 wchar_t localized[MAX_LOADSTRING]; 673 wchar_t localized[MAX_LOADSTRING];
674 int length = LoadString(GetModuleHandle(NULL), message_id, 674 int length = LoadString(GetModuleHandle(NULL), message_id,
675 localized, MAX_LOADSTRING); 675 localized, MAX_LOADSTRING);
676 if (!length && GetLastError() == ERROR_RESOURCE_NAME_NOT_FOUND) { 676 if (!length && GetLastError() == ERROR_RESOURCE_NAME_NOT_FOUND) {
677 NOTREACHED(); 677 NOTREACHED();
678 return L"No string for this identifier!"; 678 return L"No string for this identifier!";
679 } 679 }
680 return string16(localized, length); 680 return base::string16(localized, length);
681 } 681 }
682 682
683 // TODO(tc): Convert this to using resources from test_shell.rc. 683 // TODO(tc): Convert this to using resources from test_shell.rc.
684 base::StringPiece TestShellWebKitInit::GetDataResource( 684 base::StringPiece TestShellWebKitInit::GetDataResource(
685 int resource_id, 685 int resource_id,
686 ui::ScaleFactor scale_factor) { 686 ui::ScaleFactor scale_factor) {
687 switch (resource_id) { 687 switch (resource_id) {
688 case IDR_BROKENIMAGE: { 688 case IDR_BROKENIMAGE: {
689 // Use webkit's broken image icon (16x16) 689 // Use webkit's broken image icon (16x16)
690 static std::string broken_image_data; 690 static std::string broken_image_data;
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
736 736
737 bool EnsureFontLoaded(HFONT font) { 737 bool EnsureFontLoaded(HFONT font) {
738 return true; 738 return true;
739 } 739 }
740 740
741 bool DownloadUrl(const std::string& url, HWND caller_window) { 741 bool DownloadUrl(const std::string& url, HWND caller_window) {
742 return false; 742 return false;
743 } 743 }
744 744
745 } // namespace webkit_glue 745 } // namespace webkit_glue
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698