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

Unified Diff: ash/common/system/tray/system_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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/common/system/tray/system_tray_bubble.cc ('k') | ash/common/system/tray/tray_background_view.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/common/system/tray/system_tray_unittest.cc
diff --git a/ash/common/system/tray/system_tray_unittest.cc b/ash/common/system/tray/system_tray_unittest.cc
index 4a9dcc0fbae9e8e36d538e7191f1e1eff68cd268..a531447ceccc5a393db26115e2407604f3b30f37 100644
--- a/ash/common/system/tray/system_tray_unittest.cc
+++ b/ash/common/system/tray/system_tray_unittest.cc
@@ -7,6 +7,7 @@
#include <string>
#include <vector>
+#include "ash/common/accelerators/accelerator_controller.h"
#include "ash/common/accessibility_delegate.h"
#include "ash/common/shelf/wm_shelf.h"
#include "ash/common/shell_window_ids.h"
@@ -203,6 +204,33 @@ TEST_F(SystemTrayTest, SystemTrayDefaultView) {
ASSERT_FALSE(tray->CloseSystemBubble());
}
+// Make sure the opening system tray bubble will not deactivate the
+// other window. crbug.com/120680.
+TEST_F(SystemTrayTest, Activation) {
+ SystemTray* tray = GetPrimarySystemTray();
+ std::unique_ptr<views::Widget> widget(CreateTestWidget(
+ nullptr, kShellWindowId_DefaultContainer, gfx::Rect(0, 0, 100, 100)));
+ EXPECT_TRUE(widget->IsActive());
+
+ tray->ShowDefaultView(BUBBLE_CREATE_NEW);
+ ASSERT_TRUE(tray->GetWidget());
+ EXPECT_FALSE(tray->GetSystemBubble()->bubble_view()->GetWidget()->IsActive());
+ EXPECT_TRUE(widget->IsActive());
+
+ tray->ActivateBubble();
+ EXPECT_TRUE(tray->GetSystemBubble()->bubble_view()->GetWidget()->IsActive());
+ EXPECT_FALSE(widget->IsActive());
+
+ // Accelerator will activate the bubble.
+ tray->CloseSystemBubble();
+
+ EXPECT_TRUE(widget->IsActive());
+ WmShell::Get()->accelerator_controller()->PerformActionIfEnabled(
+ SHOW_SYSTEM_TRAY_BUBBLE);
+ EXPECT_TRUE(tray->GetSystemBubble()->bubble_view()->GetWidget()->IsActive());
+ EXPECT_FALSE(widget->IsActive());
+}
+
// Opening and closing the bubble should change the coloring of the tray.
TEST_F(SystemTrayTest, SystemTrayColoring) {
SystemTray* tray = GetPrimarySystemTray();
@@ -445,6 +473,7 @@ TEST_F(SystemTrayTest, PersistentBubble) {
// Tests for usual default view while activating a window.
tray->ShowDefaultView(BUBBLE_CREATE_NEW);
+ tray->ActivateBubble();
ASSERT_TRUE(tray->HasSystemBubble());
widget->Activate();
base::RunLoop().RunUntilIdle();
@@ -472,6 +501,18 @@ TEST_F(SystemTrayTest, PersistentBubble) {
generator.ClickLeftButton();
ASSERT_TRUE(tray->HasSystemBubble());
}
+
+ // Same tests for persistent default view with activation.
+ tray->ShowPersistentDefaultView();
+ EXPECT_TRUE(tray->HasSystemBubble());
+ widget->Activate();
+ base::RunLoop().RunUntilIdle();
+ EXPECT_TRUE(tray->HasSystemBubble());
+
+ ui::test::EventGenerator& generator = GetEventGenerator();
+ generator.set_current_location(gfx::Point(5, 5));
+ generator.ClickLeftButton();
+ EXPECT_TRUE(tray->HasSystemBubble());
}
#if defined(OS_CHROMEOS)
« no previous file with comments | « ash/common/system/tray/system_tray_bubble.cc ('k') | ash/common/system/tray/tray_background_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698