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

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

Issue 672673005: Remove IsHighDPIEnabled, move EnableHighDPISupport to only place it's used (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@dpi-cleanup-5
Patch Set: rebase-6 Created 6 years, 1 month 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_bundle_win.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/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 455 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 EXPECT_EQ("this is id 6", resource_bundle->GetRawDataResourceForScale(6, 466 EXPECT_EQ("this is id 6", resource_bundle->GetRawDataResourceForScale(6,
467 SCALE_FACTOR_100P)); 467 SCALE_FACTOR_100P));
468 EXPECT_EQ("this is id 6", resource_bundle->GetRawDataResourceForScale(6, 468 EXPECT_EQ("this is id 6", resource_bundle->GetRawDataResourceForScale(6,
469 SCALE_FACTOR_200P)); 469 SCALE_FACTOR_200P));
470 } 470 }
471 471
472 // Test requesting image reps at various scale factors from the image returned 472 // Test requesting image reps at various scale factors from the image returned
473 // via ResourceBundle::GetImageNamed(). 473 // via ResourceBundle::GetImageNamed().
474 TEST_F(ResourceBundleImageTest, GetImageNamed) { 474 TEST_F(ResourceBundleImageTest, GetImageNamed) {
475 #if defined(OS_WIN) 475 #if defined(OS_WIN)
476 gfx::ForceHighDPISupportForTesting(2.0); 476 gfx::InitDeviceScaleFactor(2.0);
477 #endif 477 #endif
478 std::vector<ScaleFactor> supported_factors; 478 std::vector<ScaleFactor> supported_factors;
479 supported_factors.push_back(SCALE_FACTOR_100P); 479 supported_factors.push_back(SCALE_FACTOR_100P);
480 supported_factors.push_back(SCALE_FACTOR_200P); 480 supported_factors.push_back(SCALE_FACTOR_200P);
481 test::ScopedSetSupportedScaleFactors scoped_supported(supported_factors); 481 test::ScopedSetSupportedScaleFactors scoped_supported(supported_factors);
482 base::FilePath data_1x_path = dir_path().AppendASCII("sample_1x.pak"); 482 base::FilePath data_1x_path = dir_path().AppendASCII("sample_1x.pak");
483 base::FilePath data_2x_path = dir_path().AppendASCII("sample_2x.pak"); 483 base::FilePath data_2x_path = dir_path().AppendASCII("sample_2x.pak");
484 484
485 // Create the pak files. 485 // Create the pak files.
486 CreateDataPackWithSingleBitmap(data_1x_path, 10, base::StringPiece()); 486 CreateDataPackWithSingleBitmap(data_1x_path, 10, base::StringPiece());
(...skipping 134 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_bundle_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698