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/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "chrome/browser/ui/browser.h" | 8 #include "chrome/browser/ui/browser.h" |
9 #include "chrome/browser/ui/global_error/global_error.h" | 9 #include "chrome/browser/ui/global_error/global_error.h" |
10 #include "chrome/browser/ui/global_error/global_error_bubble_view_base.h" | 10 #include "chrome/browser/ui/global_error/global_error_bubble_view_base.h" |
11 #include "chrome/browser/ui/global_error/global_error_service_factory.h" | 11 #include "chrome/browser/ui/global_error/global_error_service_factory.h" |
12 #include "chrome/test/base/in_process_browser_test.h" | 12 #include "chrome/test/base/in_process_browser_test.h" |
13 #include "chrome/test/base/ui_test_utils.h" | 13 #include "content/public/test/test_utils.h" |
14 | 14 |
15 namespace { | 15 namespace { |
16 | 16 |
17 // An error that has a bubble view. | 17 // An error that has a bubble view. |
18 class BubbleViewError : public GlobalErrorWithStandardBubble { | 18 class BubbleViewError : public GlobalErrorWithStandardBubble { |
19 public: | 19 public: |
20 BubbleViewError() : bubble_view_close_count_(0) { } | 20 BubbleViewError() : bubble_view_close_count_(0) { } |
21 | 21 |
22 int bubble_view_close_count() { return bubble_view_close_count_; } | 22 int bubble_view_close_count() { return bubble_view_close_count_; } |
23 | 23 |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 EXPECT_TRUE(error->HasShownBubbleView()); | 130 EXPECT_TRUE(error->HasShownBubbleView()); |
131 EXPECT_EQ(0, error->bubble_view_close_count()); | 131 EXPECT_EQ(0, error->bubble_view_close_count()); |
132 | 132 |
133 // Removing |error| from profile should dismiss the bubble view without | 133 // Removing |error| from profile should dismiss the bubble view without |
134 // calling |error->BubbleViewDidClose|. | 134 // calling |error->BubbleViewDidClose|. |
135 service->RemoveGlobalError(error.get()); | 135 service->RemoveGlobalError(error.get()); |
136 content::RunAllPendingInMessageLoop(); | 136 content::RunAllPendingInMessageLoop(); |
137 EXPECT_EQ(1, error->bubble_view_close_count()); | 137 EXPECT_EQ(1, error->bubble_view_close_count()); |
138 // |error| is no longer owned by service and will be deleted. | 138 // |error| is no longer owned by service and will be deleted. |
139 } | 139 } |
OLD | NEW |