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

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

Issue 623293004: replace OVERRIDE and FINAL with override and final in ui/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase on master Created 6 years, 2 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
« no previous file with comments | « ui/base/resource/resource_bundle.cc ('k') | ui/base/resource/resource_data_dll_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/big_endian.h" 8 #include "base/big_endian.h"
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 gfx::Image(int resource_id, 70 gfx::Image(int resource_id,
71 ui::ResourceBundle::ImageRTL rtl)); 71 ui::ResourceBundle::ImageRTL rtl));
72 MOCK_METHOD2(LoadDataResourceBytes, 72 MOCK_METHOD2(LoadDataResourceBytes,
73 base::RefCountedStaticMemory*(int resource_id, 73 base::RefCountedStaticMemory*(int resource_id,
74 ui::ScaleFactor scale_factor)); 74 ui::ScaleFactor scale_factor));
75 MOCK_METHOD2(GetRawDataResourceMock, base::StringPiece( 75 MOCK_METHOD2(GetRawDataResourceMock, base::StringPiece(
76 int resource_id, 76 int resource_id,
77 ui::ScaleFactor scale_factor)); 77 ui::ScaleFactor scale_factor));
78 virtual bool GetRawDataResource(int resource_id, 78 virtual bool GetRawDataResource(int resource_id,
79 ui::ScaleFactor scale_factor, 79 ui::ScaleFactor scale_factor,
80 base::StringPiece* value) OVERRIDE { 80 base::StringPiece* value) override {
81 *value = GetRawDataResourceMock(resource_id, scale_factor); 81 *value = GetRawDataResourceMock(resource_id, scale_factor);
82 return true; 82 return true;
83 } 83 }
84 MOCK_METHOD1(GetLocalizedStringMock, base::string16(int message_id)); 84 MOCK_METHOD1(GetLocalizedStringMock, base::string16(int message_id));
85 virtual bool GetLocalizedString(int message_id, 85 virtual bool GetLocalizedString(int message_id,
86 base::string16* value) OVERRIDE { 86 base::string16* value) override {
87 *value = GetLocalizedStringMock(message_id); 87 *value = GetLocalizedStringMock(message_id);
88 return true; 88 return true;
89 } 89 }
90 MOCK_METHOD1(GetFontMock, 90 MOCK_METHOD1(GetFontMock,
91 gfx::Font*(ui::ResourceBundle::FontStyle style)); 91 gfx::Font*(ui::ResourceBundle::FontStyle style));
92 virtual scoped_ptr<gfx::Font> GetFont( 92 virtual scoped_ptr<gfx::Font> GetFont(
93 ui::ResourceBundle::FontStyle style) OVERRIDE { 93 ui::ResourceBundle::FontStyle style) override {
94 return scoped_ptr<gfx::Font>(GetFontMock(style)); 94 return scoped_ptr<gfx::Font>(GetFontMock(style));
95 } 95 }
96 }; 96 };
97 97
98 // Returns |bitmap_data| with |custom_chunk| inserted after the IHDR chunk. 98 // Returns |bitmap_data| with |custom_chunk| inserted after the IHDR chunk.
99 void AddCustomChunk(const base::StringPiece& custom_chunk, 99 void AddCustomChunk(const base::StringPiece& custom_chunk,
100 std::vector<unsigned char>* bitmap_data) { 100 std::vector<unsigned char>* bitmap_data) {
101 EXPECT_LT(arraysize(kPngMagic) + kPngChunkMetadataSize, bitmap_data->size()); 101 EXPECT_LT(arraysize(kPngMagic) + kPngChunkMetadataSize, bitmap_data->size());
102 EXPECT_TRUE(std::equal( 102 EXPECT_TRUE(std::equal(
103 bitmap_data->begin(), 103 bitmap_data->begin(),
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 146
147 class ResourceBundleTest : public testing::Test { 147 class ResourceBundleTest : public testing::Test {
148 public: 148 public:
149 ResourceBundleTest() : resource_bundle_(NULL) { 149 ResourceBundleTest() : resource_bundle_(NULL) {
150 } 150 }
151 151
152 virtual ~ResourceBundleTest() { 152 virtual ~ResourceBundleTest() {
153 } 153 }
154 154
155 // Overridden from testing::Test: 155 // Overridden from testing::Test:
156 virtual void TearDown() OVERRIDE { 156 virtual void TearDown() override {
157 delete resource_bundle_; 157 delete resource_bundle_;
158 } 158 }
159 159
160 // Returns new ResoureBundle with the specified |delegate|. The 160 // Returns new ResoureBundle with the specified |delegate|. The
161 // ResourceBundleTest class manages the lifetime of the returned 161 // ResourceBundleTest class manages the lifetime of the returned
162 // ResourceBundle. 162 // ResourceBundle.
163 ResourceBundle* CreateResourceBundle(ResourceBundle::Delegate* delegate) { 163 ResourceBundle* CreateResourceBundle(ResourceBundle::Delegate* delegate) {
164 DCHECK(!resource_bundle_); 164 DCHECK(!resource_bundle_);
165 165
166 resource_bundle_ = new ResourceBundle(delegate); 166 resource_bundle_ = new ResourceBundle(delegate);
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 EXPECT_FALSE(resource_bundle->LocaleDataPakExists("not_a_real_locale")); 376 EXPECT_FALSE(resource_bundle->LocaleDataPakExists("not_a_real_locale"));
377 } 377 }
378 378
379 class ResourceBundleImageTest : public ResourceBundleTest { 379 class ResourceBundleImageTest : public ResourceBundleTest {
380 public: 380 public:
381 ResourceBundleImageTest() {} 381 ResourceBundleImageTest() {}
382 382
383 virtual ~ResourceBundleImageTest() { 383 virtual ~ResourceBundleImageTest() {
384 } 384 }
385 385
386 virtual void SetUp() OVERRIDE { 386 virtual void SetUp() override {
387 // Create a temporary directory to write test resource bundles to. 387 // Create a temporary directory to write test resource bundles to.
388 ASSERT_TRUE(dir_.CreateUniqueTempDir()); 388 ASSERT_TRUE(dir_.CreateUniqueTempDir());
389 } 389 }
390 390
391 // Returns resource bundle which uses an empty data pak for locale data. 391 // Returns resource bundle which uses an empty data pak for locale data.
392 ui::ResourceBundle* CreateResourceBundleWithEmptyLocalePak() { 392 ui::ResourceBundle* CreateResourceBundleWithEmptyLocalePak() {
393 // Write an empty data pak for locale data. 393 // Write an empty data pak for locale data.
394 const base::FilePath& locale_path = dir_path().Append( 394 const base::FilePath& locale_path = dir_path().Append(
395 FILE_PATH_LITERAL("locale.pak")); 395 FILE_PATH_LITERAL("locale.pak"));
396 EXPECT_EQ(base::WriteFile(locale_path, kEmptyPakContents, kEmptyPakSize), 396 EXPECT_EQ(base::WriteFile(locale_path, kEmptyPakContents, kEmptyPakSize),
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
621 resource_bundle->AddDataPackFromPath(data_default_path, SCALE_FACTOR_NONE); 621 resource_bundle->AddDataPackFromPath(data_default_path, SCALE_FACTOR_NONE);
622 622
623 gfx::ImageSkia* image_skia = resource_bundle->GetImageSkiaNamed(3); 623 gfx::ImageSkia* image_skia = resource_bundle->GetImageSkiaNamed(3);
624 EXPECT_EQ(1u, image_skia->image_reps().size()); 624 EXPECT_EQ(1u, image_skia->image_reps().size());
625 EXPECT_TRUE(image_skia->image_reps()[0].unscaled()); 625 EXPECT_TRUE(image_skia->image_reps()[0].unscaled());
626 EXPECT_EQ(ui::SCALE_FACTOR_100P, 626 EXPECT_EQ(ui::SCALE_FACTOR_100P,
627 GetSupportedScaleFactor(image_skia->image_reps()[0].scale())); 627 GetSupportedScaleFactor(image_skia->image_reps()[0].scale()));
628 } 628 }
629 629
630 } // namespace ui 630 } // namespace ui
OLDNEW
« no previous file with comments | « ui/base/resource/resource_bundle.cc ('k') | ui/base/resource/resource_data_dll_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698