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

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
« no previous file with comments | « ash/system/web_notification/ash_popup_alignment_delegate.cc ('k') | no next file » | 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 "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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 int origin_x = alignment_delegate()->GetToastOriginX(toast_size); 163 int origin_x = alignment_delegate()->GetToastOriginX(toast_size);
164 int baseline = alignment_delegate()->GetBaseLine(); 164 int baseline = alignment_delegate()->GetBaseLine();
165 165
166 scoped_ptr<aura::Window> window( 166 scoped_ptr<aura::Window> window(
167 CreateTestWindowInShellWithBounds(gfx::Rect(0, 0, 50, 50))); 167 CreateTestWindowInShellWithBounds(gfx::Rect(0, 0, 50, 50)));
168 aura::Window* docked_container = Shell::GetContainer( 168 aura::Window* docked_container = Shell::GetContainer(
169 Shell::GetPrimaryRootWindow(), 169 Shell::GetPrimaryRootWindow(),
170 kShellWindowId_DockedContainer); 170 kShellWindowId_DockedContainer);
171 docked_container->AddChild(window.get()); 171 docked_container->AddChild(window.get());
172 172
173 // Left-side dock should not affect popup alignment
173 EXPECT_EQ(origin_x, alignment_delegate()->GetToastOriginX(toast_size)); 174 EXPECT_EQ(origin_x, alignment_delegate()->GetToastOriginX(toast_size));
174 EXPECT_EQ(baseline, alignment_delegate()->GetBaseLine()); 175 EXPECT_EQ(baseline, alignment_delegate()->GetBaseLine());
175 EXPECT_FALSE(alignment_delegate()->IsTopDown()); 176 EXPECT_FALSE(alignment_delegate()->IsTopDown());
177 EXPECT_FALSE(alignment_delegate()->IsFromLeft());
178
179 // Force dock to right-side
180 Shell::GetInstance()->SetShelfAlignment(SHELF_ALIGNMENT_LEFT,
181 Shell::GetPrimaryRootWindow());
182 Shell::GetInstance()->SetShelfAlignment(SHELF_ALIGNMENT_BOTTOM,
183 Shell::GetPrimaryRootWindow());
184
185 // Right-side dock should not affect popup alignment
186 EXPECT_EQ(origin_x, alignment_delegate()->GetToastOriginX(toast_size));
187 EXPECT_EQ(baseline, alignment_delegate()->GetBaseLine());
188 EXPECT_FALSE(alignment_delegate()->IsTopDown());
176 EXPECT_FALSE(alignment_delegate()->IsFromLeft()); 189 EXPECT_FALSE(alignment_delegate()->IsFromLeft());
177 } 190 }
178 191
179 TEST_F(AshPopupAlignmentDelegateTest, DisplayResize) { 192 TEST_F(AshPopupAlignmentDelegateTest, DisplayResize) {
180 const gfx::Rect toast_size(0, 0, 10, 10); 193 const gfx::Rect toast_size(0, 0, 10, 10);
181 UpdateDisplay("600x600"); 194 UpdateDisplay("600x600");
182 int origin_x = alignment_delegate()->GetToastOriginX(toast_size); 195 int origin_x = alignment_delegate()->GetToastOriginX(toast_size);
183 int baseline = alignment_delegate()->GetBaseLine(); 196 int baseline = alignment_delegate()->GetBaseLine();
184 197
185 UpdateDisplay("800x800"); 198 UpdateDisplay("800x800");
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 SetAlignmentDelegate(scoped_ptr<AshPopupAlignmentDelegate>()); 253 SetAlignmentDelegate(scoped_ptr<AshPopupAlignmentDelegate>());
241 254
242 UpdateDisplay("600x600,800x800"); 255 UpdateDisplay("600x600,800x800");
243 SetAlignmentDelegate(make_scoped_ptr(new AshPopupAlignmentDelegate())); 256 SetAlignmentDelegate(make_scoped_ptr(new AshPopupAlignmentDelegate()));
244 257
245 EXPECT_GT(600, 258 EXPECT_GT(600,
246 alignment_delegate()->GetToastOriginX(gfx::Rect(0, 0, 10, 10))); 259 alignment_delegate()->GetToastOriginX(gfx::Rect(0, 0, 10, 10)));
247 } 260 }
248 261
249 } // namespace ash 262 } // namespace ash
OLDNEW
« no previous file with comments | « ash/system/web_notification/ash_popup_alignment_delegate.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698