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

Side by Side Diff: ui/wm/core/shadow_unittest.cc

Issue 681873003: Standardize usage of virtual/override/final specifiers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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/wm/core/shadow_controller_unittest.cc ('k') | ui/wm/core/transient_window_controller.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/wm/core/shadow.h" 5 #include "ui/wm/core/shadow.h"
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/path_service.h" 8 #include "base/path_service.h"
9 #include "third_party/skia/include/core/SkBitmap.h" 9 #include "third_party/skia/include/core/SkBitmap.h"
10 #include "ui/aura/test/aura_test_base.h" 10 #include "ui/aura/test/aura_test_base.h"
(...skipping 17 matching lines...) Expand all
28 public: 28 public:
29 MockResourceBundleDelegate() : last_resource_id_(0) { 29 MockResourceBundleDelegate() : last_resource_id_(0) {
30 SkBitmap bitmap_small, bitmap_large; 30 SkBitmap bitmap_small, bitmap_large;
31 bitmap_small.allocPixels( 31 bitmap_small.allocPixels(
32 SkImageInfo::MakeN32Premul(kSmallBitmapSize, kSmallBitmapSize)); 32 SkImageInfo::MakeN32Premul(kSmallBitmapSize, kSmallBitmapSize));
33 bitmap_large.allocPixels( 33 bitmap_large.allocPixels(
34 SkImageInfo::MakeN32Premul(kLargeBitmapSize, kLargeBitmapSize)); 34 SkImageInfo::MakeN32Premul(kLargeBitmapSize, kLargeBitmapSize));
35 image_small_ = gfx::Image::CreateFrom1xBitmap(bitmap_small); 35 image_small_ = gfx::Image::CreateFrom1xBitmap(bitmap_small);
36 image_large_ = gfx::Image::CreateFrom1xBitmap(bitmap_large); 36 image_large_ = gfx::Image::CreateFrom1xBitmap(bitmap_large);
37 } 37 }
38 virtual ~MockResourceBundleDelegate() {} 38 ~MockResourceBundleDelegate() override {}
39 39
40 // ResourceBundle::Delegate: 40 // ResourceBundle::Delegate:
41 virtual base::FilePath GetPathForResourcePack( 41 base::FilePath GetPathForResourcePack(const base::FilePath& pack_path,
42 const base::FilePath& pack_path, 42 ui::ScaleFactor scale_factor) override {
43 ui::ScaleFactor scale_factor) override {
44 return base::FilePath(); 43 return base::FilePath();
45 } 44 }
46 virtual base::FilePath GetPathForLocalePack( 45 base::FilePath GetPathForLocalePack(const base::FilePath& pack_path,
47 const base::FilePath& pack_path, 46 const std::string& locale) override {
48 const std::string& locale) override {
49 return base::FilePath(); 47 return base::FilePath();
50 } 48 }
51 virtual gfx::Image GetImageNamed(int resource_id) override { 49 gfx::Image GetImageNamed(int resource_id) override {
52 last_resource_id_ = resource_id; 50 last_resource_id_ = resource_id;
53 switch (resource_id) { 51 switch (resource_id) {
54 case IDR_WINDOW_BUBBLE_SHADOW_SMALL: 52 case IDR_WINDOW_BUBBLE_SHADOW_SMALL:
55 return image_small_; 53 return image_small_;
56 case IDR_AURA_SHADOW_ACTIVE: 54 case IDR_AURA_SHADOW_ACTIVE:
57 case IDR_AURA_SHADOW_INACTIVE: 55 case IDR_AURA_SHADOW_INACTIVE:
58 return image_large_; 56 return image_large_;
59 default: 57 default:
60 NOTREACHED(); 58 NOTREACHED();
61 return gfx::Image(); 59 return gfx::Image();
62 } 60 }
63 } 61 }
64 virtual gfx::Image GetNativeImageNamed( 62 gfx::Image GetNativeImageNamed(int resource_id,
65 int resource_id, ui::ResourceBundle::ImageRTL rtl) override { 63 ui::ResourceBundle::ImageRTL rtl) override {
66 return gfx::Image(); 64 return gfx::Image();
67 } 65 }
68 virtual base::RefCountedStaticMemory* LoadDataResourceBytes( 66 base::RefCountedStaticMemory* LoadDataResourceBytes(
69 int resource_id, ui::ScaleFactor scale_factor) override { 67 int resource_id,
68 ui::ScaleFactor scale_factor) override {
70 return NULL; 69 return NULL;
71 } 70 }
72 virtual bool GetRawDataResource( 71 bool GetRawDataResource(int resource_id,
73 int resource_id, ui::ScaleFactor scale_factor, 72 ui::ScaleFactor scale_factor,
74 base::StringPiece* value) override { 73 base::StringPiece* value) override {
75 return false; 74 return false;
76 } 75 }
77 virtual bool GetLocalizedString( 76 bool GetLocalizedString(int message_id, base::string16* value) override {
78 int message_id, base::string16* value) override {
79 return false; 77 return false;
80 } 78 }
81 virtual scoped_ptr<gfx::Font> GetFont( 79 scoped_ptr<gfx::Font> GetFont(ui::ResourceBundle::FontStyle style) override {
82 ui::ResourceBundle::FontStyle style) override {
83 return scoped_ptr<gfx::Font>(); 80 return scoped_ptr<gfx::Font>();
84 } 81 }
85 82
86 int last_resource_id() const { return last_resource_id_; } 83 int last_resource_id() const { return last_resource_id_; }
87 84
88 private: 85 private:
89 gfx::Image image_small_; 86 gfx::Image image_small_;
90 gfx::Image image_large_; 87 gfx::Image image_large_;
91 int last_resource_id_; 88 int last_resource_id_;
92 89
93 DISALLOW_COPY_AND_ASSIGN(MockResourceBundleDelegate); 90 DISALLOW_COPY_AND_ASSIGN(MockResourceBundleDelegate);
94 }; 91 };
95 92
96 } // namespace 93 } // namespace
97 94
98 class ShadowTest: public aura::test::AuraTestBase { 95 class ShadowTest: public aura::test::AuraTestBase {
99 public: 96 public:
100 ShadowTest() {} 97 ShadowTest() {}
101 virtual ~ShadowTest() {} 98 ~ShadowTest() override {}
102 99
103 MockResourceBundleDelegate* delegate() { return delegate_.get(); } 100 MockResourceBundleDelegate* delegate() { return delegate_.get(); }
104 101
105 // aura::testAuraBase: 102 // aura::testAuraBase:
106 virtual void SetUp() override { 103 void SetUp() override {
107 aura::test::AuraTestBase::SetUp(); 104 aura::test::AuraTestBase::SetUp();
108 delegate_.reset(new MockResourceBundleDelegate()); 105 delegate_.reset(new MockResourceBundleDelegate());
109 if (ResourceBundle::HasSharedInstance()) 106 if (ResourceBundle::HasSharedInstance())
110 ui::ResourceBundle::CleanupSharedInstance(); 107 ui::ResourceBundle::CleanupSharedInstance();
111 ui::ResourceBundle::InitSharedInstanceWithLocale( 108 ui::ResourceBundle::InitSharedInstanceWithLocale(
112 "en-US", delegate(), ui::ResourceBundle::LOAD_COMMON_RESOURCES); 109 "en-US", delegate(), ui::ResourceBundle::LOAD_COMMON_RESOURCES);
113 } 110 }
114 virtual void TearDown() override { 111 void TearDown() override {
115 ui::ResourceBundle::CleanupSharedInstance(); 112 ui::ResourceBundle::CleanupSharedInstance();
116 base::FilePath ui_test_pak_path; 113 base::FilePath ui_test_pak_path;
117 ASSERT_TRUE(PathService::Get(ui::UI_TEST_PAK, &ui_test_pak_path)); 114 ASSERT_TRUE(PathService::Get(ui::UI_TEST_PAK, &ui_test_pak_path));
118 ui::ResourceBundle::InitSharedInstanceWithPakPath(ui_test_pak_path); 115 ui::ResourceBundle::InitSharedInstanceWithPakPath(ui_test_pak_path);
119 aura::test::AuraTestBase::TearDown(); 116 aura::test::AuraTestBase::TearDown();
120 } 117 }
121 private: 118 private:
122 scoped_ptr<MockResourceBundleDelegate> delegate_; 119 scoped_ptr<MockResourceBundleDelegate> delegate_;
123 DISALLOW_COPY_AND_ASSIGN(ShadowTest); 120 DISALLOW_COPY_AND_ASSIGN(ShadowTest);
124 }; 121 };
(...skipping 19 matching lines...) Expand all
144 gfx::Rect content_bounds(100, 100, 300, 300); 141 gfx::Rect content_bounds(100, 100, 300, 300);
145 shadow.SetContentBounds(content_bounds); 142 shadow.SetContentBounds(content_bounds);
146 EXPECT_EQ(shadow.content_bounds(), content_bounds); 143 EXPECT_EQ(shadow.content_bounds(), content_bounds);
147 EXPECT_EQ(shadow.layer()->bounds(), gfx::Rect(36, 36, 428, 428)); 144 EXPECT_EQ(shadow.layer()->bounds(), gfx::Rect(36, 36, 428, 428));
148 145
149 shadow.SetStyle(Shadow::STYLE_SMALL); 146 shadow.SetStyle(Shadow::STYLE_SMALL);
150 EXPECT_EQ(shadow.content_bounds(), content_bounds); 147 EXPECT_EQ(shadow.content_bounds(), content_bounds);
151 EXPECT_EQ(shadow.layer()->bounds(), gfx::Rect(96, 96, 308, 308)); 148 EXPECT_EQ(shadow.layer()->bounds(), gfx::Rect(96, 96, 308, 308));
152 } 149 }
153 } // namespace wm 150 } // namespace wm
OLDNEW
« no previous file with comments | « ui/wm/core/shadow_controller_unittest.cc ('k') | ui/wm/core/transient_window_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698