| 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" |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 | 105 |
| 106 // Explicitly close the bubble view. | 106 // Explicitly close the bubble view. |
| 107 EXPECT_TRUE(error->GetBubbleView()); | 107 EXPECT_TRUE(error->GetBubbleView()); |
| 108 error->GetBubbleView()->CloseBubbleView(); | 108 error->GetBubbleView()->CloseBubbleView(); |
| 109 content::RunAllPendingInMessageLoop(); | 109 content::RunAllPendingInMessageLoop(); |
| 110 EXPECT_EQ(1, error->bubble_view_close_count()); | 110 EXPECT_EQ(1, error->bubble_view_close_count()); |
| 111 } | 111 } |
| 112 | 112 |
| 113 // Test that bubble is silently dismissed if it is showing when the GlobalError | 113 // Test that bubble is silently dismissed if it is showing when the GlobalError |
| 114 // instance is removed from the profile. | 114 // instance is removed from the profile. |
| 115 #if defined(OS_WIN) | 115 #if defined(OS_WIN) || defined(OS_LINUX) |
| 116 // http://crbug.com/396473 |
| 116 #define MAYBE_BubbleViewDismissedOnRemove DISABLED_BubbleViewDismissedOnRemove | 117 #define MAYBE_BubbleViewDismissedOnRemove DISABLED_BubbleViewDismissedOnRemove |
| 117 #else | 118 #else |
| 118 #define MAYBE_BubbleViewDismissedOnRemove BubbleViewDismissedOnRemove | 119 #define MAYBE_BubbleViewDismissedOnRemove BubbleViewDismissedOnRemove |
| 119 #endif | 120 #endif |
| 120 IN_PROC_BROWSER_TEST_F(GlobalErrorServiceBrowserTest, | 121 IN_PROC_BROWSER_TEST_F(GlobalErrorServiceBrowserTest, |
| 121 MAYBE_BubbleViewDismissedOnRemove) { | 122 MAYBE_BubbleViewDismissedOnRemove) { |
| 122 scoped_ptr<BubbleViewError> error(new BubbleViewError); | 123 scoped_ptr<BubbleViewError> error(new BubbleViewError); |
| 123 | 124 |
| 124 GlobalErrorService* service = | 125 GlobalErrorService* service = |
| 125 GlobalErrorServiceFactory::GetForProfile(browser()->profile()); | 126 GlobalErrorServiceFactory::GetForProfile(browser()->profile()); |
| 126 service->AddGlobalError(error.get()); | 127 service->AddGlobalError(error.get()); |
| 127 | 128 |
| 128 EXPECT_EQ(error.get(), service->GetFirstGlobalErrorWithBubbleView()); | 129 EXPECT_EQ(error.get(), service->GetFirstGlobalErrorWithBubbleView()); |
| 129 error->ShowBubbleView(browser()); | 130 error->ShowBubbleView(browser()); |
| 130 content::RunAllPendingInMessageLoop(); | 131 content::RunAllPendingInMessageLoop(); |
| 131 EXPECT_TRUE(error->HasShownBubbleView()); | 132 EXPECT_TRUE(error->HasShownBubbleView()); |
| 132 EXPECT_EQ(0, error->bubble_view_close_count()); | 133 EXPECT_EQ(0, error->bubble_view_close_count()); |
| 133 | 134 |
| 134 // Removing |error| from profile should dismiss the bubble view without | 135 // Removing |error| from profile should dismiss the bubble view without |
| 135 // calling |error->BubbleViewDidClose|. | 136 // calling |error->BubbleViewDidClose|. |
| 136 service->RemoveGlobalError(error.get()); | 137 service->RemoveGlobalError(error.get()); |
| 137 content::RunAllPendingInMessageLoop(); | 138 content::RunAllPendingInMessageLoop(); |
| 138 EXPECT_EQ(1, error->bubble_view_close_count()); | 139 EXPECT_EQ(1, error->bubble_view_close_count()); |
| 139 // |error| is no longer owned by service and will be deleted. | 140 // |error| is no longer owned by service and will be deleted. |
| 140 } | 141 } |
| OLD | NEW |