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

Side by Side Diff: chrome/browser/gtk/status_icons/status_tray_gtk_unittest.cc

Issue 6251001: Move chrome/browser/gtk/ to chrome/browser/ui/gtk/... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "app/menus/simple_menu_model.h"
6 #include "app/resource_bundle.h"
7 #include "base/string_util.h"
8 #include "base/utf_string_conversions.h"
9 #include "chrome/browser/gtk/status_icons/status_icon_gtk.h"
10 #include "chrome/browser/gtk/status_icons/status_tray_gtk.h"
11 #include "grit/browser_resources.h"
12 #include "grit/theme_resources.h"
13 #include "testing/gmock/include/gmock/gmock.h"
14 #include "testing/gtest/include/gtest/gtest.h"
15
16 namespace {
17
18 class MockStatusIconObserver : public StatusIcon::Observer {
19 public:
20 MOCK_METHOD0(OnClicked, void());
21 };
22
23 TEST(StatusTrayGtkTest, CreateTray) {
24 // Just tests creation/destruction.
25 StatusTrayGtk tray;
26 }
27
28 TEST(StatusTrayGtkTest, CreateIcon) {
29 // Create an icon, set the images and tooltip, then shut it down.
30 StatusTrayGtk tray;
31 StatusIcon* icon = tray.CreateStatusIcon();
32 SkBitmap* bitmap = ResourceBundle::GetSharedInstance().GetBitmapNamed(
33 IDR_STATUS_TRAY_ICON);
34 icon->SetImage(*bitmap);
35 icon->SetPressedImage(*bitmap);
36 icon->SetToolTip(ASCIIToUTF16("tool tip"));
37 menus::SimpleMenuModel* menu = new menus::SimpleMenuModel(NULL);
38 menu->AddItem(0, ASCIIToUTF16("foo"));
39 icon->SetContextMenu(menu);
40 }
41
42 TEST(StatusTrayGtkTest, ClickOnIcon) {
43 // Create an icon, send a fake click event, make sure observer is called.
44 StatusTrayGtk tray;
45 StatusIconGtk* icon = static_cast<StatusIconGtk*>(tray.CreateStatusIcon());
46 MockStatusIconObserver observer;
47 icon->AddObserver(&observer);
48 EXPECT_CALL(observer, OnClicked());
49 // Mimic a click.
50 icon->OnClick(NULL);
51 icon->RemoveObserver(&observer);
52 }
53
54 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/gtk/status_icons/status_tray_gtk.cc ('k') | chrome/browser/gtk/tab_contents_container_gtk.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698