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/tools/test_shell/test_shell.h" | 5 #include "webkit/tools/test_shell/test_shell.h" |
6 | 6 |
7 #include <errno.h> | 7 #include <errno.h> |
8 #include <fcntl.h> | 8 #include <fcntl.h> |
9 #include <fontconfig/fontconfig.h> | 9 #include <fontconfig/fontconfig.h> |
10 #include <gtk/gtk.h> | 10 #include <gtk/gtk.h> |
11 #include <signal.h> | 11 #include <signal.h> |
12 #include <unistd.h> | 12 #include <unistd.h> |
13 | 13 |
14 #include "base/file_util.h" | 14 #include "base/file_util.h" |
15 #include "base/files/file_path.h" | 15 #include "base/files/file_path.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/string16.h" | 18 #include "base/string16.h.h" |
19 #include "base/string_piece.h" | 19 #include "base/string_piece.h" |
20 #include "base/utf_string_conversions.h" | 20 #include "base/utf_string_conversions.h" |
21 #include "grit/test_shell_resources.h" | 21 #include "grit/test_shell_resources.h" |
22 #include "grit/webkit_resources.h" | 22 #include "grit/webkit_resources.h" |
23 #include "net/base/mime_util.h" | 23 #include "net/base/mime_util.h" |
24 #include "net/base/net_util.h" | 24 #include "net/base/net_util.h" |
25 #include "third_party/WebKit/Source/Platform/chromium/public/WebPoint.h" | 25 #include "third_party/WebKit/Source/Platform/chromium/public/WebPoint.h" |
26 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" | 26 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
27 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" | 27 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
28 #include "ui/base/gtk/gtk_compat.h" | 28 #include "ui/base/gtk/gtk_compat.h" |
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
471 GtkWidget* window = | 471 GtkWidget* window = |
472 gtk_widget_get_parent(gtk_widget_get_parent(drawing_area)); | 472 gtk_widget_get_parent(gtk_widget_get_parent(drawing_area)); |
473 gtk_widget_destroy(window); | 473 gtk_widget_destroy(window); |
474 } | 474 } |
475 | 475 |
476 void TestShell::ResizeSubViews() { | 476 void TestShell::ResizeSubViews() { |
477 // This function is used on Windows to re-layout the window on a resize. | 477 // This function is used on Windows to re-layout the window on a resize. |
478 // GTK manages layout for us so we do nothing. | 478 // GTK manages layout for us so we do nothing. |
479 } | 479 } |
480 | 480 |
481 /* static */ void TestShell::DumpAllBackForwardLists(string16* result) { | 481 /* static */ void TestShell::DumpAllBackForwardLists(base::string16* result) { |
482 result->clear(); | 482 result->clear(); |
483 for (WindowList::iterator iter = TestShell::windowList()->begin(); | 483 for (WindowList::iterator iter = TestShell::windowList()->begin(); |
484 iter != TestShell::windowList()->end(); iter++) { | 484 iter != TestShell::windowList()->end(); iter++) { |
485 GtkWindow* window = *iter; | 485 GtkWindow* window = *iter; |
486 TestShell* shell = | 486 TestShell* shell = |
487 static_cast<TestShell*>(g_object_get_data(G_OBJECT(window), | 487 static_cast<TestShell*>(g_object_get_data(G_OBJECT(window), |
488 "test-shell")); | 488 "test-shell")); |
489 shell->DumpBackForwardList(result); | 489 shell->DumpBackForwardList(result); |
490 } | 490 } |
491 } | 491 } |
492 | 492 |
493 void TestShell::LoadURLForFrame(const GURL& url, | 493 void TestShell::LoadURLForFrame(const GURL& url, |
494 const string16& frame_name) { | 494 const base::string16& frame_name) { |
495 if (!url.is_valid()) | 495 if (!url.is_valid()) |
496 return; | 496 return; |
497 | 497 |
498 if (IsSVGTestURL(url)) { | 498 if (IsSVGTestURL(url)) { |
499 SizeToSVG(); | 499 SizeToSVG(); |
500 } else { | 500 } else { |
501 // only resize back to the default when running tests | 501 // only resize back to the default when running tests |
502 if (layout_test_mode()) | 502 if (layout_test_mode()) |
503 SizeToDefault(); | 503 SizeToDefault(); |
504 } | 504 } |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
558 gtk_widget_destroy(dialog); | 558 gtk_widget_destroy(dialog); |
559 } | 559 } |
560 | 560 |
561 // static | 561 // static |
562 base::StringPiece TestShell::ResourceProvider(int key) { | 562 base::StringPiece TestShell::ResourceProvider(int key) { |
563 return ResourceBundle::GetSharedInstance().GetRawDataResource(key); | 563 return ResourceBundle::GetSharedInstance().GetRawDataResource(key); |
564 } | 564 } |
565 | 565 |
566 //----------------------------------------------------------------------------- | 566 //----------------------------------------------------------------------------- |
567 | 567 |
568 string16 TestShellWebKitInit::GetLocalizedString(int message_id) { | 568 base::string16 TestShellWebKitInit::GetLocalizedString(int message_id) { |
569 return ResourceBundle::GetSharedInstance().GetLocalizedString(message_id); | 569 return ResourceBundle::GetSharedInstance().GetLocalizedString(message_id); |
570 } | 570 } |
571 | 571 |
572 base::StringPiece TestShellWebKitInit::GetDataResource( | 572 base::StringPiece TestShellWebKitInit::GetDataResource( |
573 int resource_id, | 573 int resource_id, |
574 ui::ScaleFactor scale_factor) { | 574 ui::ScaleFactor scale_factor) { |
575 switch (resource_id) { | 575 switch (resource_id) { |
576 case IDR_BROKENIMAGE: | 576 case IDR_BROKENIMAGE: |
577 resource_id = IDR_BROKENIMAGE_TESTSHELL; | 577 resource_id = IDR_BROKENIMAGE_TESTSHELL; |
578 break; | 578 break; |
579 case IDR_TEXTAREA_RESIZER: | 579 case IDR_TEXTAREA_RESIZER: |
580 resource_id = IDR_TEXTAREA_RESIZER_TESTSHELL; | 580 resource_id = IDR_TEXTAREA_RESIZER_TESTSHELL; |
581 break; | 581 break; |
582 } | 582 } |
583 // TODO(flackr): Pass scale_factor. | 583 // TODO(flackr): Pass scale_factor. |
584 return TestShell::ResourceProvider(resource_id); | 584 return TestShell::ResourceProvider(resource_id); |
585 } | 585 } |
OLD | NEW |