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

Side by Side Diff: ash/system/web_notification/ash_popup_alignment_delegate_unittest.cc

Issue 1121893004: Have Notifications appear over docked windows (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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
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 "ash/system/web_notification/ash_popup_alignment_delegate.h" 5 #include "ash/system/web_notification/ash_popup_alignment_delegate.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "ash/display/display_manager.h" 9 #include "ash/display/display_manager.h"
10 #include "ash/shelf/shelf_layout_manager.h" 10 #include "ash/shelf/shelf_layout_manager.h"
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 int origin_x = alignment_delegate()->GetToastOriginX(toast_size); 153 int origin_x = alignment_delegate()->GetToastOriginX(toast_size);
154 int baseline = alignment_delegate()->GetBaseLine(); 154 int baseline = alignment_delegate()->GetBaseLine();
155 155
156 scoped_ptr<aura::Window> window( 156 scoped_ptr<aura::Window> window(
157 CreateTestWindowInShellWithBounds(gfx::Rect(0, 0, 50, 50))); 157 CreateTestWindowInShellWithBounds(gfx::Rect(0, 0, 50, 50)));
158 aura::Window* docked_container = Shell::GetContainer( 158 aura::Window* docked_container = Shell::GetContainer(
159 Shell::GetPrimaryRootWindow(), 159 Shell::GetPrimaryRootWindow(),
160 kShellWindowId_DockedContainer); 160 kShellWindowId_DockedContainer);
161 docked_container->AddChild(window.get()); 161 docked_container->AddChild(window.get());
162 162
163 // Left-side dock should not affect popup alignment
163 EXPECT_EQ(origin_x, alignment_delegate()->GetToastOriginX(toast_size)); 164 EXPECT_EQ(origin_x, alignment_delegate()->GetToastOriginX(toast_size));
164 EXPECT_EQ(baseline, alignment_delegate()->GetBaseLine()); 165 EXPECT_EQ(baseline, alignment_delegate()->GetBaseLine());
165 EXPECT_FALSE(alignment_delegate()->IsTopDown()); 166 EXPECT_FALSE(alignment_delegate()->IsTopDown());
167 EXPECT_FALSE(alignment_delegate()->IsFromLeft());
168
169 // Force dock to right-side
170 Shell::GetInstance()->SetShelfAlignment(SHELF_ALIGNMENT_LEFT,
171 Shell::GetPrimaryRootWindow());
172 Shell::GetInstance()->SetShelfAlignment(SHELF_ALIGNMENT_BOTTOM,
173 Shell::GetPrimaryRootWindow());
174
175 // Right-side dock should not affect popup alignment
176 EXPECT_EQ(origin_x, alignment_delegate()->GetToastOriginX(toast_size));
177 EXPECT_EQ(baseline, alignment_delegate()->GetBaseLine());
178 EXPECT_FALSE(alignment_delegate()->IsTopDown());
166 EXPECT_FALSE(alignment_delegate()->IsFromLeft()); 179 EXPECT_FALSE(alignment_delegate()->IsFromLeft());
167 } 180 }
168 181
169 TEST_F(AshPopupAlignmentDelegateTest, DisplayResize) { 182 TEST_F(AshPopupAlignmentDelegateTest, DisplayResize) {
170 const gfx::Rect toast_size(0, 0, 10, 10); 183 const gfx::Rect toast_size(0, 0, 10, 10);
171 UpdateDisplay("600x600"); 184 UpdateDisplay("600x600");
172 int origin_x = alignment_delegate()->GetToastOriginX(toast_size); 185 int origin_x = alignment_delegate()->GetToastOriginX(toast_size);
173 int baseline = alignment_delegate()->GetBaseLine(); 186 int baseline = alignment_delegate()->GetBaseLine();
174 187
175 UpdateDisplay("800x800"); 188 UpdateDisplay("800x800");
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 225
213 const int kTrayHeight = 100; 226 const int kTrayHeight = 100;
214 alignment_delegate()->SetSystemTrayHeight(kTrayHeight); 227 alignment_delegate()->SetSystemTrayHeight(kTrayHeight);
215 228
216 EXPECT_EQ(origin_x, alignment_delegate()->GetToastOriginX(toast_size)); 229 EXPECT_EQ(origin_x, alignment_delegate()->GetToastOriginX(toast_size));
217 EXPECT_EQ(baseline - kTrayHeight - message_center::kMarginBetweenItems, 230 EXPECT_EQ(baseline - kTrayHeight - message_center::kMarginBetweenItems,
218 alignment_delegate()->GetBaseLine()); 231 alignment_delegate()->GetBaseLine());
219 } 232 }
220 233
221 } // namespace ash 234 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698