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

Side by Side Diff: chrome/browser/status_icons/status_icon_unittest.cc

Issue 629603002: replace OVERRIDE and FINAL with override and final in chrome/browser/[r-z]* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase on master Created 6 years, 2 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
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 "chrome/browser/status_icons/status_icon.h" 5 #include "chrome/browser/status_icons/status_icon.h"
6 6
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "chrome/browser/status_icons/status_icon_observer.h" 8 #include "chrome/browser/status_icons/status_icon_observer.h"
9 #include "testing/gmock/include/gmock/gmock.h" 9 #include "testing/gmock/include/gmock/gmock.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
11 11
12 class MockStatusIconObserver : public StatusIconObserver { 12 class MockStatusIconObserver : public StatusIconObserver {
13 public: 13 public:
14 MOCK_METHOD0(OnStatusIconClicked, void()); 14 MOCK_METHOD0(OnStatusIconClicked, void());
15 }; 15 };
16 16
17 // Define pure virtual functions so we can test base class functionality. 17 // Define pure virtual functions so we can test base class functionality.
18 class TestStatusIcon : public StatusIcon { 18 class TestStatusIcon : public StatusIcon {
19 public: 19 public:
20 TestStatusIcon() {} 20 TestStatusIcon() {}
21 virtual void SetImage(const gfx::ImageSkia& image) OVERRIDE {} 21 virtual void SetImage(const gfx::ImageSkia& image) override {}
22 virtual void SetToolTip(const base::string16& tool_tip) OVERRIDE {} 22 virtual void SetToolTip(const base::string16& tool_tip) override {}
23 virtual void UpdatePlatformContextMenu( 23 virtual void UpdatePlatformContextMenu(
24 StatusIconMenuModel* menu) OVERRIDE {} 24 StatusIconMenuModel* menu) override {}
25 virtual void DisplayBalloon(const gfx::ImageSkia& icon, 25 virtual void DisplayBalloon(const gfx::ImageSkia& icon,
26 const base::string16& title, 26 const base::string16& title,
27 const base::string16& contents) OVERRIDE {} 27 const base::string16& contents) override {}
28 }; 28 };
29 29
30 TEST(StatusIconTest, ObserverAdd) { 30 TEST(StatusIconTest, ObserverAdd) {
31 // Make sure that observers are invoked when we click items. 31 // Make sure that observers are invoked when we click items.
32 TestStatusIcon icon; 32 TestStatusIcon icon;
33 MockStatusIconObserver observer, observer2; 33 MockStatusIconObserver observer, observer2;
34 EXPECT_CALL(observer, OnStatusIconClicked()).Times(2); 34 EXPECT_CALL(observer, OnStatusIconClicked()).Times(2);
35 EXPECT_CALL(observer2, OnStatusIconClicked()); 35 EXPECT_CALL(observer2, OnStatusIconClicked());
36 icon.AddObserver(&observer); 36 icon.AddObserver(&observer);
37 icon.DispatchClickEvent(); 37 icon.DispatchClickEvent();
38 icon.AddObserver(&observer2); 38 icon.AddObserver(&observer2);
39 icon.DispatchClickEvent(); 39 icon.DispatchClickEvent();
40 icon.RemoveObserver(&observer); 40 icon.RemoveObserver(&observer);
41 icon.RemoveObserver(&observer2); 41 icon.RemoveObserver(&observer2);
42 } 42 }
43 43
44 TEST(StatusIconTest, ObserverRemove) { 44 TEST(StatusIconTest, ObserverRemove) {
45 // Make sure that observers are no longer invoked after they are removed. 45 // Make sure that observers are no longer invoked after they are removed.
46 TestStatusIcon icon; 46 TestStatusIcon icon;
47 MockStatusIconObserver observer; 47 MockStatusIconObserver observer;
48 EXPECT_CALL(observer, OnStatusIconClicked()); 48 EXPECT_CALL(observer, OnStatusIconClicked());
49 icon.AddObserver(&observer); 49 icon.AddObserver(&observer);
50 icon.DispatchClickEvent(); 50 icon.DispatchClickEvent();
51 icon.RemoveObserver(&observer); 51 icon.RemoveObserver(&observer);
52 icon.DispatchClickEvent(); 52 icon.DispatchClickEvent();
53 } 53 }
OLDNEW
« no previous file with comments | « chrome/browser/status_icons/status_icon_menu_model_unittest.cc ('k') | chrome/browser/status_icons/status_tray_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698