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 <ApplicationServices/ApplicationServices.h> | 5 #include <ApplicationServices/ApplicationServices.h> |
6 #import <Cocoa/Cocoa.h> | 6 #import <Cocoa/Cocoa.h> |
7 #import <objc/objc-runtime.h> | 7 #import <objc/objc-runtime.h> |
8 #include <sys/stat.h> | 8 #include <sys/stat.h> |
9 | 9 |
10 #include "webkit/tools/test_shell/test_shell.h" | 10 #include "webkit/tools/test_shell/test_shell.h" |
11 | 11 |
12 #include "base/base_paths.h" | 12 #include "base/base_paths.h" |
13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
14 #include "base/debug/debugger.h" | 14 #include "base/debug/debugger.h" |
15 #include "base/file_util.h" | 15 #include "base/file_util.h" |
16 #include "base/files/file_path.h" | 16 #include "base/files/file_path.h" |
17 #include "base/logging.h" | 17 #include "base/logging.h" |
18 #include "base/mac/bundle_locations.h" | 18 #include "base/mac/bundle_locations.h" |
19 #include "base/mac/mac_util.h" | 19 #include "base/mac/mac_util.h" |
20 #include "base/mac/scoped_nsautorelease_pool.h" | 20 #include "base/mac/scoped_nsautorelease_pool.h" |
21 #include "base/message_loop.h" | 21 #include "base/message_loop.h" |
22 #include "base/path_service.h" | 22 #include "base/path_service.h" |
23 #include "base/string16.h" | 23 #include "base/string16.h.h" |
24 #include "base/string_piece.h" | 24 #include "base/string_piece.h" |
25 #include "base/utf_string_conversions.h" | 25 #include "base/utf_string_conversions.h" |
26 #include "grit/webkit_resources.h" | 26 #include "grit/webkit_resources.h" |
27 #include "net/base/mime_util.h" | 27 #include "net/base/mime_util.h" |
28 #include "skia/ext/bitmap_platform_device.h" | 28 #include "skia/ext/bitmap_platform_device.h" |
29 #include "testing/gtest/include/gtest/gtest.h" | 29 #include "testing/gtest/include/gtest/gtest.h" |
30 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" | 30 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
31 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" | 31 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
32 #include "ui/base/resource/data_pack.h" | 32 #include "ui/base/resource/data_pack.h" |
33 #include "ui/gfx/size.h" | 33 #include "ui/gfx/size.h" |
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
501 NSRect r = [m_mainWnd contentRectForFrameRect:[m_mainWnd frame]]; | 501 NSRect r = [m_mainWnd contentRectForFrameRect:[m_mainWnd frame]]; |
502 r.size.width = width; | 502 r.size.width = width; |
503 r.size.height = height + URLBAR_HEIGHT; | 503 r.size.height = height + URLBAR_HEIGHT; |
504 [m_mainWnd setFrame:[m_mainWnd frameRectForContentRect:r] display:YES]; | 504 [m_mainWnd setFrame:[m_mainWnd frameRectForContentRect:r] display:YES]; |
505 } | 505 } |
506 | 506 |
507 void TestShell::ResizeSubViews() { | 507 void TestShell::ResizeSubViews() { |
508 // handled by Cocoa for us | 508 // handled by Cocoa for us |
509 } | 509 } |
510 | 510 |
511 /* static */ void TestShell::DumpAllBackForwardLists(string16* result) { | 511 /* static */ void TestShell::DumpAllBackForwardLists(base::string16* result) { |
512 result->clear(); | 512 result->clear(); |
513 for (WindowList::iterator iter = TestShell::windowList()->begin(); | 513 for (WindowList::iterator iter = TestShell::windowList()->begin(); |
514 iter != TestShell::windowList()->end(); iter++) { | 514 iter != TestShell::windowList()->end(); iter++) { |
515 NSWindow* window = *iter; | 515 NSWindow* window = *iter; |
516 WindowMap::iterator it = window_map_.Get().find(window); | 516 WindowMap::iterator it = window_map_.Get().find(window); |
517 if (it != window_map_.Get().end()) | 517 if (it != window_map_.Get().end()) |
518 it->second->DumpBackForwardList(result); | 518 it->second->DumpBackForwardList(result); |
519 else | 519 else |
520 LOG(ERROR) << "Failed to find shell for window during dump"; | 520 LOG(ERROR) << "Failed to find shell for window during dump"; |
521 } | 521 } |
522 } | 522 } |
523 | 523 |
524 void TestShell::LoadURLForFrame(const GURL& url, | 524 void TestShell::LoadURLForFrame(const GURL& url, |
525 const string16& frame_name) { | 525 const base::string16& frame_name) { |
526 if (!url.is_valid()) | 526 if (!url.is_valid()) |
527 return; | 527 return; |
528 | 528 |
529 if (IsSVGTestURL(url)) { | 529 if (IsSVGTestURL(url)) { |
530 SizeTo(kSVGTestWindowWidth, kSVGTestWindowHeight); | 530 SizeTo(kSVGTestWindowWidth, kSVGTestWindowHeight); |
531 } else { | 531 } else { |
532 // only resize back to the default when running tests | 532 // only resize back to the default when running tests |
533 if (layout_test_mode()) | 533 if (layout_test_mode()) |
534 SizeToDefault(); | 534 SizeToDefault(); |
535 } | 535 } |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
589 } | 589 } |
590 | 590 |
591 base::StringPiece TestShell::ResourceProvider(int key) { | 591 base::StringPiece TestShell::ResourceProvider(int key) { |
592 base::StringPiece res; | 592 base::StringPiece res; |
593 g_resource_data_pack->GetStringPiece(key, &res); | 593 g_resource_data_pack->GetStringPiece(key, &res); |
594 return res; | 594 return res; |
595 } | 595 } |
596 | 596 |
597 //----------------------------------------------------------------------------- | 597 //----------------------------------------------------------------------------- |
598 | 598 |
599 string16 TestShellWebKitInit::GetLocalizedString(int message_id) { | 599 base::string16 TestShellWebKitInit::GetLocalizedString(int message_id) { |
600 base::StringPiece res; | 600 base::StringPiece res; |
601 if (!g_resource_data_pack->GetStringPiece(message_id, &res)) { | 601 if (!g_resource_data_pack->GetStringPiece(message_id, &res)) { |
602 LOG(FATAL) << "failed to load webkit string with id " << message_id; | 602 LOG(FATAL) << "failed to load webkit string with id " << message_id; |
603 } | 603 } |
604 | 604 |
605 // Data packs hold strings as either UTF8 or UTF16. | 605 // Data packs hold strings as either UTF8 or UTF16. |
606 string16 msg; | 606 base::string16 msg; |
607 switch (g_resource_data_pack->GetTextEncodingType()) { | 607 switch (g_resource_data_pack->GetTextEncodingType()) { |
608 case ui::DataPack::UTF8: | 608 case ui::DataPack::UTF8: |
609 msg = UTF8ToUTF16(res); | 609 msg = UTF8ToUTF16(res); |
610 break; | 610 break; |
611 case ui::DataPack::UTF16: | 611 case ui::DataPack::UTF16: |
612 msg = string16(reinterpret_cast<const char16*>(res.data()), | 612 msg = base::string16(reinterpret_cast<const char16*>(res.data()), |
613 res.length() / 2); | 613 res.length() / 2); |
614 break; | 614 break; |
615 case ui::DataPack::BINARY: | 615 case ui::DataPack::BINARY: |
616 NOTREACHED(); | 616 NOTREACHED(); |
617 break; | 617 break; |
618 } | 618 } |
619 | 619 |
620 return msg; | 620 return msg; |
621 } | 621 } |
622 | 622 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
677 return false; | 677 return false; |
678 } | 678 } |
679 | 679 |
680 void DidLoadPlugin(const std::string& filename) { | 680 void DidLoadPlugin(const std::string& filename) { |
681 } | 681 } |
682 | 682 |
683 void DidUnloadPlugin(const std::string& filename) { | 683 void DidUnloadPlugin(const std::string& filename) { |
684 } | 684 } |
685 | 685 |
686 } // namespace webkit_glue | 686 } // namespace webkit_glue |
OLD | NEW |