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

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

Issue 2330403002: Do not activate system tray bubble by default (Closed)
Patch Set: Do not activate system tray bubble by default Created 4 years, 3 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/mus/bridge/wm_shell_mus.cc ('k') | ui/views/bubble/tray_bubble_view.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/common/system/web_notification/web_notification_tray.h" 5 #include "ash/common/system/web_notification/web_notification_tray.h"
6 6
7 #include <utility> 7 #include <utility>
8 #include <vector> 8 #include <vector>
9 9
10 #include "ash/common/shelf/shelf_layout_manager.h"
10 #include "ash/common/shelf/wm_shelf.h" 11 #include "ash/common/shelf/wm_shelf.h"
11 #include "ash/common/shell_window_ids.h" 12 #include "ash/common/shell_window_ids.h"
12 #include "ash/common/system/status_area_widget.h" 13 #include "ash/common/system/status_area_widget.h"
13 #include "ash/common/system/tray/system_tray.h" 14 #include "ash/common/system/tray/system_tray.h"
14 #include "ash/common/system/tray/system_tray_item.h" 15 #include "ash/common/system/tray/system_tray_item.h"
15 #include "ash/common/system/web_notification/ash_popup_alignment_delegate.h" 16 #include "ash/common/system/web_notification/ash_popup_alignment_delegate.h"
16 #include "ash/common/wm/window_state.h" 17 #include "ash/common/wm/window_state.h"
17 #include "ash/common/wm_lookup.h" 18 #include "ash/common/wm_lookup.h"
18 #include "ash/common/wm_window.h" 19 #include "ash/common/wm_window.h"
19 #include "ash/display/display_manager.h" 20 #include "ash/display/display_manager.h"
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 return tray->popup_alignment_delegate_->GetWorkAreaBottom(); 139 return tray->popup_alignment_delegate_->GetWorkAreaBottom();
139 } 140 }
140 141
141 bool IsPopupVisible() { return GetTray()->IsPopupVisible(); } 142 bool IsPopupVisible() { return GetTray()->IsPopupVisible(); }
142 143
143 static std::unique_ptr<views::Widget> CreateTestWidget() { 144 static std::unique_ptr<views::Widget> CreateTestWidget() {
144 return AshTestBase::CreateTestWidget( 145 return AshTestBase::CreateTestWidget(
145 nullptr, kShellWindowId_DefaultContainer, gfx::Rect(1, 2, 3, 4)); 146 nullptr, kShellWindowId_DefaultContainer, gfx::Rect(1, 2, 3, 4));
146 } 147 }
147 148
149 static void UpdateAutoHideStateNow() {
150 GetPrimaryShelf()->shelf_layout_manager()->UpdateAutoHideStateNow();
151 }
152
148 private: 153 private:
149 DISALLOW_COPY_AND_ASSIGN(WebNotificationTrayTest); 154 DISALLOW_COPY_AND_ASSIGN(WebNotificationTrayTest);
150 }; 155 };
151 156
152 INSTANTIATE_TEST_CASE_P( 157 INSTANTIATE_TEST_CASE_P(
153 /* prefix intentionally left blank due to only one parameterization */, 158 /* prefix intentionally left blank due to only one parameterization */,
154 WebNotificationTrayTest, 159 WebNotificationTrayTest,
155 testing::Values(MaterialDesignController::NON_MATERIAL, 160 testing::Values(MaterialDesignController::NON_MATERIAL,
156 MaterialDesignController::MATERIAL_NORMAL, 161 MaterialDesignController::MATERIAL_NORMAL,
157 MaterialDesignController::MATERIAL_EXPERIMENTAL)); 162 MaterialDesignController::MATERIAL_EXPERIMENTAL));
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 widget.reset(); 360 widget.reset();
356 EXPECT_EQ(SHELF_AUTO_HIDE_SHOWN, shelf->GetAutoHideState()); 361 EXPECT_EQ(SHELF_AUTO_HIDE_SHOWN, shelf->GetAutoHideState());
357 int bottom_auto_shown = GetPopupWorkAreaBottom(); 362 int bottom_auto_shown = GetPopupWorkAreaBottom();
358 EXPECT_EQ(bottom, bottom_auto_shown); 363 EXPECT_EQ(bottom, bottom_auto_shown);
359 364
360 // Create the system tray during auto-hide. 365 // Create the system tray during auto-hide.
361 widget = CreateTestWidget(); 366 widget = CreateTestWidget();
362 TestItem* test_item = new TestItem; 367 TestItem* test_item = new TestItem;
363 GetSystemTray()->AddTrayItem(test_item); 368 GetSystemTray()->AddTrayItem(test_item);
364 GetSystemTray()->ShowDefaultView(BUBBLE_CREATE_NEW); 369 GetSystemTray()->ShowDefaultView(BUBBLE_CREATE_NEW);
370 UpdateAutoHideStateNow();
365 371
366 EXPECT_EQ(SHELF_AUTO_HIDE_SHOWN, shelf->GetAutoHideState()); 372 EXPECT_EQ(SHELF_AUTO_HIDE_SHOWN, shelf->GetAutoHideState());
367 EXPECT_TRUE(GetTray()->IsPopupVisible()); 373 EXPECT_TRUE(GetTray()->IsPopupVisible());
368 int bottom_with_tray = GetPopupWorkAreaBottom(); 374 int bottom_with_tray = GetPopupWorkAreaBottom();
369 EXPECT_GT(bottom_auto_shown, bottom_with_tray); 375 EXPECT_GT(bottom_auto_shown, bottom_with_tray);
370 376
371 // Create tray notification. 377 // Create tray notification.
372 GetSystemTray()->ShowNotificationView(test_item); 378 GetSystemTray()->ShowNotificationView(test_item);
373 EXPECT_EQ(SHELF_AUTO_HIDE_SHOWN, shelf->GetAutoHideState()); 379 EXPECT_EQ(SHELF_AUTO_HIDE_SHOWN, shelf->GetAutoHideState());
374 int bottom_with_tray_notification = GetPopupWorkAreaBottom(); 380 int bottom_with_tray_notification = GetPopupWorkAreaBottom();
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 EXPECT_FALSE(tray->draw_background_as_active()); 513 EXPECT_FALSE(tray->draw_background_as_active());
508 514
509 generator.ReleaseTouch(); 515 generator.ReleaseTouch();
510 EXPECT_FALSE(tray->draw_background_as_active()); 516 EXPECT_FALSE(tray->draw_background_as_active());
511 EXPECT_FALSE(tray->IsMessageCenterBubbleVisible()); 517 EXPECT_FALSE(tray->IsMessageCenterBubbleVisible());
512 } 518 }
513 519
514 #endif // OS_CHROMEOS 520 #endif // OS_CHROMEOS
515 521
516 } // namespace ash 522 } // namespace ash
OLDNEW
« no previous file with comments | « ash/mus/bridge/wm_shell_mus.cc ('k') | ui/views/bubble/tray_bubble_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698