| OLD | NEW |
| 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 "chrome/browser/ui/views/status_icons/status_tray_win.h" | 5 #include "chrome/browser/ui/views/status_icons/status_tray_win.h" |
| 6 | 6 |
| 7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
| 8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 9 #include "chrome/browser/status_icons/status_icon_observer.h" | 9 #include "chrome/browser/status_icons/status_icon_observer.h" |
| 10 #include "chrome/browser/ui/views/status_icons/status_icon_win.h" | 10 #include "chrome/browser/ui/views/status_icons/status_icon_win.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 34 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
| 35 gfx::ImageSkia* image = rb.GetImageSkiaNamed(IDR_STATUS_TRAY_ICON); | 35 gfx::ImageSkia* image = rb.GetImageSkiaNamed(IDR_STATUS_TRAY_ICON); |
| 36 icon->SetImage(*image); | 36 icon->SetImage(*image); |
| 37 icon->SetPressedImage(*image); | 37 icon->SetPressedImage(*image); |
| 38 icon->SetToolTip(ASCIIToUTF16("tool tip")); | 38 icon->SetToolTip(ASCIIToUTF16("tool tip")); |
| 39 ui::SimpleMenuModel* menu = new ui::SimpleMenuModel(NULL); | 39 ui::SimpleMenuModel* menu = new ui::SimpleMenuModel(NULL); |
| 40 menu->AddItem(0, L"foo"); | 40 menu->AddItem(0, L"foo"); |
| 41 icon->SetContextMenu(menu); | 41 icon->SetContextMenu(menu); |
| 42 } | 42 } |
| 43 | 43 |
| 44 #if !defined(USE_AURA) // http://crbug.com/156370 |
| 44 TEST(StatusTrayWinTest, ClickOnIcon) { | 45 TEST(StatusTrayWinTest, ClickOnIcon) { |
| 45 // Create an icon, send a fake click event, make sure observer is called. | 46 // Create an icon, send a fake click event, make sure observer is called. |
| 46 StatusTrayWin tray; | 47 StatusTrayWin tray; |
| 47 StatusIconWin* icon = static_cast<StatusIconWin*>(tray.CreateStatusIcon()); | 48 StatusIconWin* icon = static_cast<StatusIconWin*>(tray.CreateStatusIcon()); |
| 48 MockStatusIconObserver observer; | 49 MockStatusIconObserver observer; |
| 49 icon->AddObserver(&observer); | 50 icon->AddObserver(&observer); |
| 50 EXPECT_CALL(observer, OnStatusIconClicked()); | 51 EXPECT_CALL(observer, OnStatusIconClicked()); |
| 51 // Mimic a click. | 52 // Mimic a click. |
| 52 tray.WndProc(NULL, icon->message_id(), icon->icon_id(), WM_LBUTTONDOWN); | 53 tray.WndProc(NULL, icon->message_id(), icon->icon_id(), WM_LBUTTONDOWN); |
| 53 // Mimic a right-click - observer should not be called. | 54 // Mimic a right-click - observer should not be called. |
| 54 tray.WndProc(NULL, icon->message_id(), icon->icon_id(), WM_RBUTTONDOWN); | 55 tray.WndProc(NULL, icon->message_id(), icon->icon_id(), WM_RBUTTONDOWN); |
| 55 icon->RemoveObserver(&observer); | 56 icon->RemoveObserver(&observer); |
| 56 } | 57 } |
| 58 // !defined(USE_AURA) |
| OLD | NEW |