OLD | NEW |
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 <memory> |
| 8 |
7 #include "base/macros.h" | 9 #include "base/macros.h" |
8 #include "base/memory/scoped_ptr.h" | |
9 #include "base/path_service.h" | 10 #include "base/path_service.h" |
10 #include "third_party/skia/include/core/SkBitmap.h" | 11 #include "third_party/skia/include/core/SkBitmap.h" |
11 #include "ui/aura/test/aura_test_base.h" | 12 #include "ui/aura/test/aura_test_base.h" |
12 #include "ui/aura/test/test_windows.h" | 13 #include "ui/aura/test/test_windows.h" |
13 #include "ui/aura/window.h" | 14 #include "ui/aura/window.h" |
14 #include "ui/base/resource/resource_bundle.h" | 15 #include "ui/base/resource/resource_bundle.h" |
15 #include "ui/base/ui_base_paths.h" | 16 #include "ui/base/ui_base_paths.h" |
16 #include "ui/compositor/layer.h" | 17 #include "ui/compositor/layer.h" |
17 #include "ui/compositor/layer_tree_owner.h" | 18 #include "ui/compositor/layer_tree_owner.h" |
18 #include "ui/resources/grit/ui_resources.h" | 19 #include "ui/resources/grit/ui_resources.h" |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 "en-US", delegate(), ui::ResourceBundle::LOAD_COMMON_RESOURCES); | 107 "en-US", delegate(), ui::ResourceBundle::LOAD_COMMON_RESOURCES); |
107 } | 108 } |
108 void TearDown() override { | 109 void TearDown() override { |
109 ui::ResourceBundle::CleanupSharedInstance(); | 110 ui::ResourceBundle::CleanupSharedInstance(); |
110 base::FilePath ui_test_pak_path; | 111 base::FilePath ui_test_pak_path; |
111 ASSERT_TRUE(PathService::Get(ui::UI_TEST_PAK, &ui_test_pak_path)); | 112 ASSERT_TRUE(PathService::Get(ui::UI_TEST_PAK, &ui_test_pak_path)); |
112 ui::ResourceBundle::InitSharedInstanceWithPakPath(ui_test_pak_path); | 113 ui::ResourceBundle::InitSharedInstanceWithPakPath(ui_test_pak_path); |
113 aura::test::AuraTestBase::TearDown(); | 114 aura::test::AuraTestBase::TearDown(); |
114 } | 115 } |
115 private: | 116 private: |
116 scoped_ptr<MockResourceBundleDelegate> delegate_; | 117 std::unique_ptr<MockResourceBundleDelegate> delegate_; |
117 DISALLOW_COPY_AND_ASSIGN(ShadowTest); | 118 DISALLOW_COPY_AND_ASSIGN(ShadowTest); |
118 }; | 119 }; |
119 | 120 |
120 // Test if the proper image is set for the specified style. | 121 // Test if the proper image is set for the specified style. |
121 TEST_F(ShadowTest, UpdateImagesForStyle) { | 122 TEST_F(ShadowTest, UpdateImagesForStyle) { |
122 Shadow shadow; | 123 Shadow shadow; |
123 | 124 |
124 shadow.Init(Shadow::STYLE_SMALL); | 125 shadow.Init(Shadow::STYLE_SMALL); |
125 EXPECT_EQ(delegate()->last_resource_id(), IDR_WINDOW_BUBBLE_SHADOW_SMALL); | 126 EXPECT_EQ(delegate()->last_resource_id(), IDR_WINDOW_BUBBLE_SHADOW_SMALL); |
126 shadow.SetStyle(Shadow::STYLE_ACTIVE); | 127 shadow.SetStyle(Shadow::STYLE_ACTIVE); |
(...skipping 11 matching lines...) Expand all Loading... |
138 gfx::Rect content_bounds(100, 100, 300, 300); | 139 gfx::Rect content_bounds(100, 100, 300, 300); |
139 shadow.SetContentBounds(content_bounds); | 140 shadow.SetContentBounds(content_bounds); |
140 EXPECT_EQ(shadow.content_bounds(), content_bounds); | 141 EXPECT_EQ(shadow.content_bounds(), content_bounds); |
141 EXPECT_EQ(shadow.layer()->bounds(), gfx::Rect(36, 36, 428, 428)); | 142 EXPECT_EQ(shadow.layer()->bounds(), gfx::Rect(36, 36, 428, 428)); |
142 | 143 |
143 shadow.SetStyle(Shadow::STYLE_SMALL); | 144 shadow.SetStyle(Shadow::STYLE_SMALL); |
144 EXPECT_EQ(shadow.content_bounds(), content_bounds); | 145 EXPECT_EQ(shadow.content_bounds(), content_bounds); |
145 EXPECT_EQ(shadow.layer()->bounds(), gfx::Rect(96, 96, 308, 308)); | 146 EXPECT_EQ(shadow.layer()->bounds(), gfx::Rect(96, 96, 308, 308)); |
146 } | 147 } |
147 } // namespace wm | 148 } // namespace wm |
OLD | NEW |