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

Side by Side Diff: ash/devtools/ash_devtools_unittest.cc

Issue 2814243002: Removes a couple more functions from WmWindow (Closed)
Patch Set: feedback Created 3 years, 8 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 | « no previous file | ash/mus/test/ash_test_impl_mus.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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "ash/devtools/ash_devtools_css_agent.h" 5 #include "ash/devtools/ash_devtools_css_agent.h"
6 #include "ash/devtools/ash_devtools_dom_agent.h" 6 #include "ash/devtools/ash_devtools_dom_agent.h"
7 #include "ash/root_window_controller.h" 7 #include "ash/root_window_controller.h"
8 #include "ash/shell.h"
8 #include "ash/shell_port.h" 9 #include "ash/shell_port.h"
9 #include "ash/test/ash_test.h" 10 #include "ash/test/ash_test.h"
10 #include "ash/wm/widget_finder.h" 11 #include "ash/wm/widget_finder.h"
11 #include "ash/wm_window.h" 12 #include "ash/wm_window.h"
12 #include "base/memory/ptr_util.h" 13 #include "base/memory/ptr_util.h"
13 #include "base/strings/stringprintf.h" 14 #include "base/strings/stringprintf.h"
14 #include "ui/display/display.h" 15 #include "ui/display/display.h"
15 #include "ui/views/background.h" 16 #include "ui/views/background.h"
16 #include "ui/views/widget/native_widget_private.h" 17 #include "ui/views/widget/native_widget_private.h"
17 #include "ui/views/widget/widget.h" 18 #include "ui/views/widget/widget.h"
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 if (property->getName() == name) { 128 if (property->getName() == name) {
128 int value; 129 int value;
129 EXPECT_TRUE(base::StringToInt(property->getValue(), &value)); 130 EXPECT_TRUE(base::StringToInt(property->getValue(), &value));
130 return value; 131 return value;
131 } 132 }
132 } 133 }
133 NOTREACHED(); 134 NOTREACHED();
134 return -1; 135 return -1;
135 } 136 }
136 137
137 WmWindow* GetHighlightingWindow(int root_window_index) { 138 aura::Window* GetHighlightingWindow(int root_window_index) {
138 WmWindow::Windows overlay_windows = 139 const aura::Window::Windows& overlay_windows =
139 ShellPort::Get() 140 Shell::GetAllRootWindows()[root_window_index]
140 ->GetAllRootWindows()[root_window_index] 141 ->GetChildById(kShellWindowId_OverlayContainer)
141 ->GetChildByShellWindowId(kShellWindowId_OverlayContainer) 142 ->children();
142 ->GetChildren(); 143 for (aura::Window* window : overlay_windows) {
143 for (WmWindow* window : overlay_windows) { 144 if (window->GetName() == "HighlightingWidget")
144 if (window->aura_window()->GetName() == "HighlightingWidget")
145 return window; 145 return window;
146 } 146 }
147 NOTREACHED(); 147 NOTREACHED();
148 return nullptr; 148 return nullptr;
149 } 149 }
150 150
151 std::unique_ptr<DOM::RGBA> SkColorToRGBA(const SkColor& color) { 151 std::unique_ptr<DOM::RGBA> SkColorToRGBA(const SkColor& color) {
152 return DOM::RGBA::create() 152 return DOM::RGBA::create()
153 .setA(SkColorGetA(color) / 255) 153 .setA(SkColorGetA(color) / 255)
154 .setB(SkColorGetB(color)) 154 .setB(SkColorGetB(color))
155 .setG(SkColorGetG(color)) 155 .setG(SkColorGetG(color))
156 .setR(SkColorGetR(color)) 156 .setR(SkColorGetR(color))
157 .build(); 157 .build();
158 } 158 }
159 159
160 std::unique_ptr<DOM::HighlightConfig> CreateHighlightConfig( 160 std::unique_ptr<DOM::HighlightConfig> CreateHighlightConfig(
161 const SkColor& background_color, 161 const SkColor& background_color,
162 const SkColor& border_color) { 162 const SkColor& border_color) {
163 return DOM::HighlightConfig::create() 163 return DOM::HighlightConfig::create()
164 .setContentColor(SkColorToRGBA(background_color)) 164 .setContentColor(SkColorToRGBA(background_color))
165 .setBorderColor(SkColorToRGBA(border_color)) 165 .setBorderColor(SkColorToRGBA(border_color))
166 .build(); 166 .build();
167 } 167 }
168 168
169 void ExpectHighlighted(const gfx::Rect& bounds, int root_window_index) { 169 void ExpectHighlighted(const gfx::Rect& bounds, int root_window_index) {
170 WmWindow* highlighting_window = GetHighlightingWindow(root_window_index); 170 aura::Window* highlighting_window = GetHighlightingWindow(root_window_index);
171 EXPECT_TRUE(highlighting_window->IsVisible()); 171 EXPECT_TRUE(highlighting_window->IsVisible());
172 EXPECT_EQ(bounds, highlighting_window->GetBoundsInScreen()); 172 EXPECT_EQ(bounds, highlighting_window->GetBoundsInScreen());
173 EXPECT_EQ(kBackgroundColor, 173 EXPECT_EQ(kBackgroundColor, GetInternalWidgetForWindow(highlighting_window)
174 GetInternalWidgetForWindow(highlighting_window->aura_window()) 174 ->GetRootView()
175 ->GetRootView() 175 ->background()
176 ->background() 176 ->get_color());
177 ->get_color());
178 } 177 }
179 178
180 } // namespace 179 } // namespace
181 180
182 class AshDevToolsTest : public AshTest { 181 class AshDevToolsTest : public AshTest {
183 public: 182 public:
184 AshDevToolsTest() {} 183 AshDevToolsTest() {}
185 ~AshDevToolsTest() override {} 184 ~AshDevToolsTest() override {}
186 185
187 views::internal::NativeWidgetPrivate* CreateTestNativeWidget() { 186 views::internal::NativeWidgetPrivate* CreateTestNativeWidget() {
(...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after
767 SetStyleTexts(root_view_node, "\nheight: 73;\n ", true); 766 SetStyleTexts(root_view_node, "\nheight: 73;\n ", true);
768 EXPECT_EQ(gfx::Rect(25, 35, 45, 73), root_view->bounds()); 767 EXPECT_EQ(gfx::Rect(25, 35, 45, 73), root_view->bounds());
769 768
770 SetStyleTexts(root_view_node, "\nx: 10; y: 23; width: 52;\nvisibility: 1;\n", 769 SetStyleTexts(root_view_node, "\nx: 10; y: 23; width: 52;\nvisibility: 1;\n",
771 true); 770 true);
772 EXPECT_EQ(gfx::Rect(10, 23, 52, 73), root_view->bounds()); 771 EXPECT_EQ(gfx::Rect(10, 23, 52, 73), root_view->bounds());
773 EXPECT_TRUE(root_view->visible()); 772 EXPECT_TRUE(root_view->visible());
774 } 773 }
775 774
776 } // namespace ash 775 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/mus/test/ash_test_impl_mus.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698