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

Side by Side Diff: ui/base/resource/resource_bundle_unittest.cc

Issue 117983002: Prefix string16 with base:: in ui/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge Created 7 years 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
« no previous file with comments | « ui/base/l10n/time_format_unittest.cc ('k') | ui/base/win/message_box_win.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "ui/base/resource/resource_bundle.h" 5 #include "ui/base/resource/resource_bundle.h"
6 6
7 #include "base/base_paths.h" 7 #include "base/base_paths.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/files/scoped_temp_dir.h" 10 #include "base/files/scoped_temp_dir.h"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 ui::ScaleFactor scale_factor)); 71 ui::ScaleFactor scale_factor));
72 MOCK_METHOD2(GetRawDataResourceMock, base::StringPiece( 72 MOCK_METHOD2(GetRawDataResourceMock, base::StringPiece(
73 int resource_id, 73 int resource_id,
74 ui::ScaleFactor scale_factor)); 74 ui::ScaleFactor scale_factor));
75 virtual bool GetRawDataResource(int resource_id, 75 virtual bool GetRawDataResource(int resource_id,
76 ui::ScaleFactor scale_factor, 76 ui::ScaleFactor scale_factor,
77 base::StringPiece* value) OVERRIDE { 77 base::StringPiece* value) OVERRIDE {
78 *value = GetRawDataResourceMock(resource_id, scale_factor); 78 *value = GetRawDataResourceMock(resource_id, scale_factor);
79 return true; 79 return true;
80 } 80 }
81 MOCK_METHOD1(GetLocalizedStringMock, string16(int message_id)); 81 MOCK_METHOD1(GetLocalizedStringMock, base::string16(int message_id));
82 virtual bool GetLocalizedString(int message_id, string16* value) OVERRIDE { 82 virtual bool GetLocalizedString(int message_id,
83 base::string16* value) OVERRIDE {
83 *value = GetLocalizedStringMock(message_id); 84 *value = GetLocalizedStringMock(message_id);
84 return true; 85 return true;
85 } 86 }
86 MOCK_METHOD1(GetFontMock, 87 MOCK_METHOD1(GetFontMock,
87 gfx::Font*(ui::ResourceBundle::FontStyle style)); 88 gfx::Font*(ui::ResourceBundle::FontStyle style));
88 virtual scoped_ptr<gfx::Font> GetFont( 89 virtual scoped_ptr<gfx::Font> GetFont(
89 ui::ResourceBundle::FontStyle style) OVERRIDE { 90 ui::ResourceBundle::FontStyle style) OVERRIDE {
90 return scoped_ptr<gfx::Font>(GetFontMock(style)); 91 return scoped_ptr<gfx::Font>(GetFontMock(style));
91 } 92 }
92 }; 93 };
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 291
291 base::StringPiece result = resource_bundle->GetRawDataResource( 292 base::StringPiece result = resource_bundle->GetRawDataResource(
292 resource_id); 293 resource_id);
293 EXPECT_EQ(string_piece.data(), result.data()); 294 EXPECT_EQ(string_piece.data(), result.data());
294 } 295 }
295 296
296 TEST_F(ResourceBundleTest, DelegateGetLocalizedString) { 297 TEST_F(ResourceBundleTest, DelegateGetLocalizedString) {
297 MockResourceBundleDelegate delegate; 298 MockResourceBundleDelegate delegate;
298 ResourceBundle* resource_bundle = CreateResourceBundle(&delegate); 299 ResourceBundle* resource_bundle = CreateResourceBundle(&delegate);
299 300
300 string16 data = ASCIIToUTF16("My test data"); 301 base::string16 data = ASCIIToUTF16("My test data");
301 int resource_id = 5; 302 int resource_id = 5;
302 303
303 EXPECT_CALL(delegate, GetLocalizedStringMock(resource_id)) 304 EXPECT_CALL(delegate, GetLocalizedStringMock(resource_id))
304 .Times(1) 305 .Times(1)
305 .WillOnce(Return(data)); 306 .WillOnce(Return(data));
306 307
307 string16 result = resource_bundle->GetLocalizedString(resource_id); 308 base::string16 result = resource_bundle->GetLocalizedString(resource_id);
308 EXPECT_EQ(data, result); 309 EXPECT_EQ(data, result);
309 } 310 }
310 311
311 #if defined(USE_OZONE) && !defined(USE_PANGO) 312 #if defined(USE_OZONE) && !defined(USE_PANGO)
312 #define MAYBE_DelegateGetFontList DISABLED_DelegateGetFontList 313 #define MAYBE_DelegateGetFontList DISABLED_DelegateGetFontList
313 #else 314 #else
314 #define MAYBE_DelegateGetFontList DelegateGetFontList 315 #define MAYBE_DelegateGetFontList DelegateGetFontList
315 #endif 316 #endif
316 317
317 TEST_F(ResourceBundleTest, MAYBE_DelegateGetFontList) { 318 TEST_F(ResourceBundleTest, MAYBE_DelegateGetFontList) {
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
571 ResourceBundle* resource_bundle = CreateResourceBundleWithEmptyLocalePak(); 572 ResourceBundle* resource_bundle = CreateResourceBundleWithEmptyLocalePak();
572 resource_bundle->AddDataPackFromPath(data_default_path, SCALE_FACTOR_NONE); 573 resource_bundle->AddDataPackFromPath(data_default_path, SCALE_FACTOR_NONE);
573 574
574 gfx::ImageSkia* image_skia = resource_bundle->GetImageSkiaNamed(3); 575 gfx::ImageSkia* image_skia = resource_bundle->GetImageSkiaNamed(3);
575 EXPECT_EQ(1u, image_skia->image_reps().size()); 576 EXPECT_EQ(1u, image_skia->image_reps().size());
576 EXPECT_EQ(ui::SCALE_FACTOR_100P, 577 EXPECT_EQ(ui::SCALE_FACTOR_100P,
577 GetSupportedScaleFactor(image_skia->image_reps()[0].scale())); 578 GetSupportedScaleFactor(image_skia->image_reps()[0].scale()));
578 } 579 }
579 580
580 } // namespace ui 581 } // namespace ui
OLDNEW
« no previous file with comments | « ui/base/l10n/time_format_unittest.cc ('k') | ui/base/win/message_box_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698