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/global_error/global_error_service.h" | 5 #include "chrome/browser/ui/global_error/global_error_service.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "chrome/browser/ui/global_error/global_error.h" | 9 #include "chrome/browser/ui/global_error/global_error.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 int BaseError::count_ = 0; | 67 int BaseError::count_ = 0; |
68 | 68 |
69 // A simple error that only has a menu item. | 69 // A simple error that only has a menu item. |
70 class MenuError : public BaseError { | 70 class MenuError : public BaseError { |
71 public: | 71 public: |
72 explicit MenuError(int command_id, Severity severity) | 72 explicit MenuError(int command_id, Severity severity) |
73 : command_id_(command_id), | 73 : command_id_(command_id), |
74 severity_(severity) { | 74 severity_(severity) { |
75 } | 75 } |
76 | 76 |
77 virtual Severity GetSeverity() { return severity_; } | 77 virtual Severity GetSeverity() OVERRIDE { return severity_; } |
78 | 78 |
79 virtual bool HasMenuItem() OVERRIDE { return true; } | 79 virtual bool HasMenuItem() OVERRIDE { return true; } |
80 virtual int MenuItemCommandID() OVERRIDE { return command_id_; } | 80 virtual int MenuItemCommandID() OVERRIDE { return command_id_; } |
81 virtual string16 MenuItemLabel() OVERRIDE { return string16(); } | 81 virtual string16 MenuItemLabel() OVERRIDE { return string16(); } |
82 virtual void ExecuteMenuItem(Browser* browser) OVERRIDE {} | 82 virtual void ExecuteMenuItem(Browser* browser) OVERRIDE {} |
83 | 83 |
84 private: | 84 private: |
85 int command_id_; | 85 int command_id_; |
86 Severity severity_; | 86 Severity severity_; |
87 | 87 |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 service.AddGlobalError(error3); | 167 service.AddGlobalError(error3); |
168 EXPECT_EQ(error3, service.GetHighestSeverityGlobalErrorWithWrenchMenuItem()); | 168 EXPECT_EQ(error3, service.GetHighestSeverityGlobalErrorWithWrenchMenuItem()); |
169 | 169 |
170 // Remove the highest-severity error. | 170 // Remove the highest-severity error. |
171 service.RemoveGlobalError(error3); | 171 service.RemoveGlobalError(error3); |
172 delete error3; | 172 delete error3; |
173 | 173 |
174 // Now error2 should be the next highest severity error. | 174 // Now error2 should be the next highest severity error. |
175 EXPECT_EQ(error2, service.GetHighestSeverityGlobalErrorWithWrenchMenuItem()); | 175 EXPECT_EQ(error2, service.GetHighestSeverityGlobalErrorWithWrenchMenuItem()); |
176 } | 176 } |
OLD | NEW |