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

Unified Diff: chrome/browser/views/status_icons/status_tray_win_unittest.cc

Issue 3189003: Added support for context menus to status icons. (Closed)
Patch Set: Final version. Created 10 years, 4 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 | « chrome/browser/views/status_icons/status_tray_win.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/views/status_icons/status_tray_win_unittest.cc
diff --git a/chrome/browser/views/status_icons/status_tray_win_unittest.cc b/chrome/browser/views/status_icons/status_tray_win_unittest.cc
index e5499b9e0e7ac8d47f8cc0467b71e041d0a544c1..c824755d71a7082e973ea8e0877531687ed4f7d2 100644
--- a/chrome/browser/views/status_icons/status_tray_win_unittest.cc
+++ b/chrome/browser/views/status_icons/status_tray_win_unittest.cc
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "app/menus/simple_menu_model.h"
#include "app/resource_bundle.h"
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
@@ -24,8 +25,9 @@ TEST(StatusTrayWinTest, CreateTray) {
StatusTrayWin tray;
}
-TEST(StatusTrayWinTest, CreateIcon) {
- // Create an icon, set the images and tooltip, then shut it down.
+TEST(StatusTrayWinTest, CreateIconAndMenu) {
+ // Create an icon, set the images, tooltip, and context menu, then shut it
+ // down.
StatusTrayWin tray;
StatusIcon* icon = tray.CreateStatusIcon();
SkBitmap* bitmap = ResourceBundle::GetSharedInstance().GetBitmapNamed(
@@ -33,6 +35,9 @@ TEST(StatusTrayWinTest, CreateIcon) {
icon->SetImage(*bitmap);
icon->SetPressedImage(*bitmap);
icon->SetToolTip(ASCIIToUTF16("tool tip"));
+ menus::SimpleMenuModel* menu = new menus::SimpleMenuModel(NULL);
+ menu->AddItem(0, L"foo");
+ icon->SetContextMenu(menu);
}
TEST(StatusTrayWinTest, ClickOnIcon) {
@@ -44,5 +49,7 @@ TEST(StatusTrayWinTest, ClickOnIcon) {
EXPECT_CALL(observer, OnClicked());
// Mimic a click.
tray.WndProc(NULL, icon->message_id(), icon->icon_id(), WM_LBUTTONDOWN);
+ // Mimic a right-click - observer should not be called.
+ tray.WndProc(NULL, icon->message_id(), icon->icon_id(), WM_RBUTTONDOWN);
icon->RemoveObserver(&observer);
}
« no previous file with comments | « chrome/browser/views/status_icons/status_tray_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698