Chromium Code Reviews| 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) |
|
viettrungluu
2014/07/23 15:26:42
Is there a bug for this?
jam
2014/07/23 16:02:06
Done. forgot to add it
| |
| 116 #define MAYBE_BubbleViewDismissedOnRemove DISABLED_BubbleViewDismissedOnRemove | 116 #define MAYBE_BubbleViewDismissedOnRemove DISABLED_BubbleViewDismissedOnRemove |
| 117 #else | 117 #else |
| 118 #define MAYBE_BubbleViewDismissedOnRemove BubbleViewDismissedOnRemove | 118 #define MAYBE_BubbleViewDismissedOnRemove BubbleViewDismissedOnRemove |
| 119 #endif | 119 #endif |
| 120 IN_PROC_BROWSER_TEST_F(GlobalErrorServiceBrowserTest, | 120 IN_PROC_BROWSER_TEST_F(GlobalErrorServiceBrowserTest, |
| 121 MAYBE_BubbleViewDismissedOnRemove) { | 121 MAYBE_BubbleViewDismissedOnRemove) { |
| 122 scoped_ptr<BubbleViewError> error(new BubbleViewError); | 122 scoped_ptr<BubbleViewError> error(new BubbleViewError); |
| 123 | 123 |
| 124 GlobalErrorService* service = | 124 GlobalErrorService* service = |
| 125 GlobalErrorServiceFactory::GetForProfile(browser()->profile()); | 125 GlobalErrorServiceFactory::GetForProfile(browser()->profile()); |
| 126 service->AddGlobalError(error.get()); | 126 service->AddGlobalError(error.get()); |
| 127 | 127 |
| 128 EXPECT_EQ(error.get(), service->GetFirstGlobalErrorWithBubbleView()); | 128 EXPECT_EQ(error.get(), service->GetFirstGlobalErrorWithBubbleView()); |
| 129 error->ShowBubbleView(browser()); | 129 error->ShowBubbleView(browser()); |
| 130 content::RunAllPendingInMessageLoop(); | 130 content::RunAllPendingInMessageLoop(); |
| 131 EXPECT_TRUE(error->HasShownBubbleView()); | 131 EXPECT_TRUE(error->HasShownBubbleView()); |
| 132 EXPECT_EQ(0, error->bubble_view_close_count()); | 132 EXPECT_EQ(0, error->bubble_view_close_count()); |
| 133 | 133 |
| 134 // Removing |error| from profile should dismiss the bubble view without | 134 // Removing |error| from profile should dismiss the bubble view without |
| 135 // calling |error->BubbleViewDidClose|. | 135 // calling |error->BubbleViewDidClose|. |
| 136 service->RemoveGlobalError(error.get()); | 136 service->RemoveGlobalError(error.get()); |
| 137 content::RunAllPendingInMessageLoop(); | 137 content::RunAllPendingInMessageLoop(); |
| 138 EXPECT_EQ(1, error->bubble_view_close_count()); | 138 EXPECT_EQ(1, error->bubble_view_close_count()); |
| 139 // |error| is no longer owned by service and will be deleted. | 139 // |error| is no longer owned by service and will be deleted. |
| 140 } | 140 } |
| OLD | NEW |