OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 <map> | 5 #include <map> |
6 #include <string> | 6 #include <string> |
7 | 7 |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 | 24 |
25 class TestAddObserver : public message_center::MessageCenterObserver { | 25 class TestAddObserver : public message_center::MessageCenterObserver { |
26 public: | 26 public: |
27 explicit TestAddObserver(message_center::MessageCenter* message_center) | 27 explicit TestAddObserver(message_center::MessageCenter* message_center) |
28 : message_center_(message_center) { | 28 : message_center_(message_center) { |
29 message_center_->AddObserver(this); | 29 message_center_->AddObserver(this); |
30 } | 30 } |
31 | 31 |
32 virtual ~TestAddObserver() { message_center_->RemoveObserver(this); } | 32 virtual ~TestAddObserver() { message_center_->RemoveObserver(this); } |
33 | 33 |
34 virtual void OnNotificationAdded(const std::string& id) OVERRIDE { | 34 virtual void OnNotificationAdded(const std::string& id) override { |
35 std::string log = logs_[id]; | 35 std::string log = logs_[id]; |
36 if (log != "") | 36 if (log != "") |
37 log += "_"; | 37 log += "_"; |
38 logs_[id] = log + "add-" + id; | 38 logs_[id] = log + "add-" + id; |
39 } | 39 } |
40 | 40 |
41 virtual void OnNotificationUpdated(const std::string& id) OVERRIDE { | 41 virtual void OnNotificationUpdated(const std::string& id) override { |
42 std::string log = logs_[id]; | 42 std::string log = logs_[id]; |
43 if (log != "") | 43 if (log != "") |
44 log += "_"; | 44 log += "_"; |
45 logs_[id] = log + "update-" + id; | 45 logs_[id] = log + "update-" + id; |
46 } | 46 } |
47 | 47 |
48 const std::string log(const std::string& id) { return logs_[id]; } | 48 const std::string log(const std::string& id) { return logs_[id]; } |
49 void reset_logs() { logs_.clear(); } | 49 void reset_logs() { logs_.clear(); } |
50 | 50 |
51 private: | 51 private: |
(...skipping 13 matching lines...) Expand all Loading... |
65 message_center::MessageCenter* message_center() { | 65 message_center::MessageCenter* message_center() { |
66 return g_browser_process->message_center(); | 66 return g_browser_process->message_center(); |
67 } | 67 } |
68 | 68 |
69 Profile* profile() { return browser()->profile(); } | 69 Profile* profile() { return browser()->profile(); } |
70 | 70 |
71 class TestDelegate : public NotificationDelegate { | 71 class TestDelegate : public NotificationDelegate { |
72 public: | 72 public: |
73 explicit TestDelegate(const std::string& id) : id_(id) {} | 73 explicit TestDelegate(const std::string& id) : id_(id) {} |
74 | 74 |
75 virtual void Display() OVERRIDE { log_ += "Display_"; } | 75 virtual void Display() override { log_ += "Display_"; } |
76 virtual void Error() OVERRIDE { log_ += "Error_"; } | 76 virtual void Error() override { log_ += "Error_"; } |
77 virtual void Close(bool by_user) OVERRIDE { | 77 virtual void Close(bool by_user) override { |
78 log_ += "Close_"; | 78 log_ += "Close_"; |
79 log_ += ( by_user ? "by_user_" : "programmatically_"); | 79 log_ += ( by_user ? "by_user_" : "programmatically_"); |
80 } | 80 } |
81 virtual void Click() OVERRIDE { log_ += "Click_"; } | 81 virtual void Click() override { log_ += "Click_"; } |
82 virtual void ButtonClick(int button_index) OVERRIDE { | 82 virtual void ButtonClick(int button_index) override { |
83 log_ += "ButtonClick_"; | 83 log_ += "ButtonClick_"; |
84 log_ += base::IntToString(button_index) + "_"; | 84 log_ += base::IntToString(button_index) + "_"; |
85 } | 85 } |
86 virtual std::string id() const OVERRIDE { return id_; } | 86 virtual std::string id() const override { return id_; } |
87 virtual content::WebContents* GetWebContents() const OVERRIDE { | 87 virtual content::WebContents* GetWebContents() const override { |
88 return NULL; | 88 return NULL; |
89 } | 89 } |
90 | 90 |
91 const std::string& log() { return log_; } | 91 const std::string& log() { return log_; } |
92 | 92 |
93 private: | 93 private: |
94 virtual ~TestDelegate() {} | 94 virtual ~TestDelegate() {} |
95 std::string id_; | 95 std::string id_; |
96 std::string log_; | 96 std::string log_; |
97 | 97 |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 manager()->Update(notification, profile()); | 355 manager()->Update(notification, profile()); |
356 | 356 |
357 // Expect that the progress notification update is performed. | 357 // Expect that the progress notification update is performed. |
358 EXPECT_EQ(base::StringPrintf("update-%s", notification_id.c_str()), | 358 EXPECT_EQ(base::StringPrintf("update-%s", notification_id.c_str()), |
359 observer.log(notification_id)); | 359 observer.log(notification_id)); |
360 | 360 |
361 delegate->Release(); | 361 delegate->Release(); |
362 } | 362 } |
363 | 363 |
364 #endif // !defined(OS_MACOSX) | 364 #endif // !defined(OS_MACOSX) |
OLD | NEW |