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 <commctrl.h> | 7 #include <commctrl.h> |
8 | 8 |
9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 bool enqueue_called_; | 35 bool enqueue_called_; |
36 UINT icon_id_; | 36 UINT icon_id_; |
37 HWND window_; | 37 HWND window_; |
38 | 38 |
39 DISALLOW_COPY_AND_ASSIGN(FakeStatusTrayStateChangerProxy); | 39 DISALLOW_COPY_AND_ASSIGN(FakeStatusTrayStateChangerProxy); |
40 }; | 40 }; |
41 | 41 |
42 class FakeStatusIconObserver : public StatusIconObserver { | 42 class FakeStatusIconObserver : public StatusIconObserver { |
43 public: | 43 public: |
44 FakeStatusIconObserver() | 44 FakeStatusIconObserver() |
45 : balloon_clicked_(false), | 45 : status_icon_click_count_(0), balloon_clicked_(false) {} |
46 status_icon_click_count_(0) {} | |
47 void OnStatusIconClicked() override { ++status_icon_click_count_; } | 46 void OnStatusIconClicked() override { ++status_icon_click_count_; } |
48 void OnBalloonClicked() override { balloon_clicked_ = true; } | 47 void OnBalloonClicked() override { balloon_clicked_ = true; } |
49 bool balloon_clicked() const { return balloon_clicked_; } | 48 bool balloon_clicked() const { return balloon_clicked_; } |
50 size_t status_icon_click_count() const { | 49 size_t status_icon_click_count() const { |
51 return status_icon_click_count_; | 50 return status_icon_click_count_; |
52 } | 51 } |
53 | 52 |
54 private: | 53 private: |
55 size_t status_icon_click_count_; | 54 size_t status_icon_click_count_; |
56 bool balloon_clicked_; | 55 bool balloon_clicked_; |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 StatusIconWin* icon = static_cast<StatusIconWin*>(tray.CreateStatusIcon( | 137 StatusIconWin* icon = static_cast<StatusIconWin*>(tray.CreateStatusIcon( |
139 StatusTray::OTHER_ICON, *image, base::ASCIIToUTF16("tool tip"))); | 138 StatusTray::OTHER_ICON, *image, base::ASCIIToUTF16("tool tip"))); |
140 | 139 |
141 icon->ForceVisible(); | 140 icon->ForceVisible(); |
142 // |proxy| is owned by |tray|, and |tray| lives to the end of the scope, | 141 // |proxy| is owned by |tray|, and |tray| lives to the end of the scope, |
143 // so calling methods on |proxy| is safe. | 142 // so calling methods on |proxy| is safe. |
144 EXPECT_TRUE(proxy->enqueue_called()); | 143 EXPECT_TRUE(proxy->enqueue_called()); |
145 EXPECT_EQ(proxy->window(), icon->window()); | 144 EXPECT_EQ(proxy->window(), icon->window()); |
146 EXPECT_EQ(proxy->icon_id(), icon->icon_id()); | 145 EXPECT_EQ(proxy->icon_id(), icon->icon_id()); |
147 } | 146 } |
OLD | NEW |