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

Side by Side Diff: webkit/tools/test_shell/test_shell_mac.mm

Issue 10387010: Select theme resources from ResourceBundle at requested scale factor. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge with master. Created 8 years, 7 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 <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"
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 205
206 window_list_ = new WindowList; 206 window_list_ = new WindowList;
207 layout_test_mode_ = layout_test_mode; 207 layout_test_mode_ = layout_test_mode;
208 allow_external_pages_ = allow_external_pages; 208 allow_external_pages_ = allow_external_pages;
209 209
210 web_prefs_ = new webkit_glue::WebPreferences; 210 web_prefs_ = new webkit_glue::WebPreferences;
211 211
212 // mmap the data pack which holds strings used by WebCore. This is only 212 // mmap the data pack which holds strings used by WebCore. This is only
213 // a fatal error if we're bundled, which means we might be running layout 213 // a fatal error if we're bundled, which means we might be running layout
214 // tests. This is a harmless failure for test_shell_tests. 214 // tests. This is a harmless failure for test_shell_tests.
215 g_resource_data_pack = new ui::DataPack(ui::ResourceHandle::kScaleFactor100x); 215 g_resource_data_pack = new ui::DataPack(ui::SCALE_FACTOR_100P);
216 NSString *resource_path = 216 NSString *resource_path =
217 [base::mac::FrameworkBundle() pathForResource:@"test_shell" 217 [base::mac::FrameworkBundle() pathForResource:@"test_shell"
218 ofType:@"pak"]; 218 ofType:@"pak"];
219 FilePath resources_pak_path([resource_path fileSystemRepresentation]); 219 FilePath resources_pak_path([resource_path fileSystemRepresentation]);
220 if (!g_resource_data_pack->Load(resources_pak_path)) { 220 if (!g_resource_data_pack->Load(resources_pak_path)) {
221 LOG(FATAL) << "failed to load test_shell.pak"; 221 LOG(FATAL) << "failed to load test_shell.pak";
222 } 222 }
223 223
224 ResetWebPreferences(); 224 ResetWebPreferences();
225 225
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
623 res.length() / 2); 623 res.length() / 2);
624 break; 624 break;
625 case ui::DataPack::BINARY: 625 case ui::DataPack::BINARY:
626 NOTREACHED(); 626 NOTREACHED();
627 break; 627 break;
628 } 628 }
629 629
630 return msg; 630 return msg;
631 } 631 }
632 632
633 base::StringPiece TestShellWebKitInit::GetDataResource(int resource_id) { 633 base::StringPiece TestShellWebKitInit::GetDataResource(
634 return base::StringPiece(); 634 int resource_id,
635 } 635 ui::ScaleFactor scale_factor) {
636
637 base::StringPiece TestShellWebKitInit::GetImageResource(int resource_id,
638 float scale_factor) {
639 switch (resource_id) { 636 switch (resource_id) {
640 case IDR_BROKENIMAGE: { 637 case IDR_BROKENIMAGE: {
641 // Use webkit's broken image icon (16x16) 638 // Use webkit's broken image icon (16x16)
642 static std::string broken_image_data; 639 static std::string broken_image_data;
643 if (broken_image_data.empty()) { 640 if (broken_image_data.empty()) {
644 FilePath path = GetResourcesFilePath(); 641 FilePath path = GetResourcesFilePath();
645 // In order to match WebKit's colors for the missing image, we have to 642 // In order to match WebKit's colors for the missing image, we have to
646 // use a PNG. The GIF doesn't have the color range needed to correctly 643 // use a PNG. The GIF doesn't have the color range needed to correctly
647 // match the TIFF they use in Safari. 644 // match the TIFF they use in Safari.
648 path = path.AppendASCII("missingImage.png"); 645 path = path.AppendASCII("missingImage.png");
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
698 return false; 695 return false;
699 } 696 }
700 697
701 void DidLoadPlugin(const std::string& filename) { 698 void DidLoadPlugin(const std::string& filename) {
702 } 699 }
703 700
704 void DidUnloadPlugin(const std::string& filename) { 701 void DidUnloadPlugin(const std::string& filename) {
705 } 702 }
706 703
707 } // namespace webkit_glue 704 } // namespace webkit_glue
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698