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

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

Issue 17948002: Update Linux to use scoped_refptr<T>::get() rather than implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 7 years, 5 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
« no previous file with comments | « ppapi/proxy/plugin_main_nacl.cc ('k') | webkit/browser/appcache/appcache_url_request_job.cc » ('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 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 258
259 // Create the data resource for testing purposes. 259 // Create the data resource for testing purposes.
260 unsigned char data[] = "My test data"; 260 unsigned char data[] = "My test data";
261 scoped_refptr<base::RefCountedStaticMemory> static_memory( 261 scoped_refptr<base::RefCountedStaticMemory> static_memory(
262 new base::RefCountedStaticMemory(data, sizeof(data))); 262 new base::RefCountedStaticMemory(data, sizeof(data)));
263 263
264 int resource_id = 5; 264 int resource_id = 5;
265 ui::ScaleFactor scale_factor = ui::SCALE_FACTOR_NONE; 265 ui::ScaleFactor scale_factor = ui::SCALE_FACTOR_NONE;
266 266
267 EXPECT_CALL(delegate, LoadDataResourceBytes(resource_id, scale_factor)) 267 EXPECT_CALL(delegate, LoadDataResourceBytes(resource_id, scale_factor))
268 .Times(1) 268 .Times(1).WillOnce(Return(static_memory.get()));
269 .WillOnce(Return(static_memory));
270 269
271 scoped_refptr<base::RefCountedStaticMemory> result = 270 scoped_refptr<base::RefCountedStaticMemory> result =
272 resource_bundle->LoadDataResourceBytesForScale(resource_id, scale_factor); 271 resource_bundle->LoadDataResourceBytesForScale(resource_id, scale_factor);
273 EXPECT_EQ(static_memory, result); 272 EXPECT_EQ(static_memory, result);
274 } 273 }
275 274
276 TEST_F(ResourceBundleTest, DelegateGetRawDataResource) { 275 TEST_F(ResourceBundleTest, DelegateGetRawDataResource) {
277 MockResourceBundleDelegate delegate; 276 MockResourceBundleDelegate delegate;
278 ResourceBundle* resource_bundle = CreateResourceBundle(&delegate); 277 ResourceBundle* resource_bundle = CreateResourceBundle(&delegate);
279 278
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
540 ResourceBundle* resource_bundle = CreateResourceBundleWithEmptyLocalePak(); 539 ResourceBundle* resource_bundle = CreateResourceBundleWithEmptyLocalePak();
541 resource_bundle->AddDataPackFromPath(data_default_path, SCALE_FACTOR_NONE); 540 resource_bundle->AddDataPackFromPath(data_default_path, SCALE_FACTOR_NONE);
542 541
543 gfx::ImageSkia* image_skia = resource_bundle->GetImageSkiaNamed(3); 542 gfx::ImageSkia* image_skia = resource_bundle->GetImageSkiaNamed(3);
544 EXPECT_EQ(1u, image_skia->image_reps().size()); 543 EXPECT_EQ(1u, image_skia->image_reps().size());
545 EXPECT_EQ(ui::SCALE_FACTOR_100P, 544 EXPECT_EQ(ui::SCALE_FACTOR_100P,
546 image_skia->image_reps()[0].scale_factor()); 545 image_skia->image_reps()[0].scale_factor());
547 } 546 }
548 547
549 } // namespace ui 548 } // namespace ui
OLDNEW
« no previous file with comments | « ppapi/proxy/plugin_main_nacl.cc ('k') | webkit/browser/appcache/appcache_url_request_job.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698