Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(118)

Side by Side Diff: chrome/browser/ui/global_error/global_error_service_browsertest.cc

Issue 10825085: Move RunAllPendingInMessageLoop from ui_test_utils.h to test_utils.h, so that it can be reused by c… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 109
110 // Creating a second browser window should show the bubble view. 110 // Creating a second browser window should show the bubble view.
111 CreateBrowser(browser()->profile()); 111 CreateBrowser(browser()->profile());
112 EXPECT_EQ(NULL, service->GetFirstGlobalErrorWithBubbleView()); 112 EXPECT_EQ(NULL, service->GetFirstGlobalErrorWithBubbleView());
113 EXPECT_TRUE(error->HasShownBubbleView()); 113 EXPECT_TRUE(error->HasShownBubbleView());
114 EXPECT_EQ(0, error->bubble_view_close_count()); 114 EXPECT_EQ(0, error->bubble_view_close_count());
115 115
116 // Explicitly close the bubble view. 116 // Explicitly close the bubble view.
117 EXPECT_TRUE(error->GetBubbleView()); 117 EXPECT_TRUE(error->GetBubbleView());
118 error->GetBubbleView()->CloseBubbleView(); 118 error->GetBubbleView()->CloseBubbleView();
119 ui_test_utils::RunAllPendingInMessageLoop(); 119 content::RunAllPendingInMessageLoop();
120 EXPECT_EQ(1, error->bubble_view_close_count()); 120 EXPECT_EQ(1, error->bubble_view_close_count());
121 } 121 }
122 122
123 // Test that bubble is silently dismissed if it is showing when the GlobalError 123 // Test that bubble is silently dismissed if it is showing when the GlobalError
124 // instance is removed from the profile. 124 // instance is removed from the profile.
125 #if defined(OS_WIN) 125 #if defined(OS_WIN)
126 #define MAYBE_BubbleViewDismissedOnRemove DISABLED_BubbleViewDismissedOnRemove 126 #define MAYBE_BubbleViewDismissedOnRemove DISABLED_BubbleViewDismissedOnRemove
127 #else 127 #else
128 #define MAYBE_BubbleViewDismissedOnRemove BubbleViewDismissedOnRemove 128 #define MAYBE_BubbleViewDismissedOnRemove BubbleViewDismissedOnRemove
129 #endif 129 #endif
130 IN_PROC_BROWSER_TEST_F(GlobalErrorServiceBrowserTest, 130 IN_PROC_BROWSER_TEST_F(GlobalErrorServiceBrowserTest,
131 MAYBE_BubbleViewDismissedOnRemove) { 131 MAYBE_BubbleViewDismissedOnRemove) {
132 scoped_ptr<BubbleViewError> error(new BubbleViewError); 132 scoped_ptr<BubbleViewError> error(new BubbleViewError);
133 133
134 GlobalErrorService* service = 134 GlobalErrorService* service =
135 GlobalErrorServiceFactory::GetForProfile(browser()->profile()); 135 GlobalErrorServiceFactory::GetForProfile(browser()->profile());
136 service->AddGlobalError(error.get()); 136 service->AddGlobalError(error.get());
137 137
138 EXPECT_EQ(error.get(), service->GetFirstGlobalErrorWithBubbleView()); 138 EXPECT_EQ(error.get(), service->GetFirstGlobalErrorWithBubbleView());
139 error->ShowBubbleView(browser()); 139 error->ShowBubbleView(browser());
140 ui_test_utils::RunAllPendingInMessageLoop(); 140 content::RunAllPendingInMessageLoop();
141 EXPECT_TRUE(error->HasShownBubbleView()); 141 EXPECT_TRUE(error->HasShownBubbleView());
142 EXPECT_EQ(0, error->bubble_view_close_count()); 142 EXPECT_EQ(0, error->bubble_view_close_count());
143 143
144 // Removing |error| from profile should dismiss the bubble view without 144 // Removing |error| from profile should dismiss the bubble view without
145 // calling |error->BubbleViewDidClose|. 145 // calling |error->BubbleViewDidClose|.
146 service->RemoveGlobalError(error.get()); 146 service->RemoveGlobalError(error.get());
147 ui_test_utils::RunAllPendingInMessageLoop(); 147 content::RunAllPendingInMessageLoop();
148 EXPECT_EQ(1, error->bubble_view_close_count()); 148 EXPECT_EQ(1, error->bubble_view_close_count());
149 // |error| is no longer owned by service and will be deleted. 149 // |error| is no longer owned by service and will be deleted.
150 } 150 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/find_bar/find_bar_host_browsertest.cc ('k') | chrome/browser/ui/login/login_prompt_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698