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

Side by Side Diff: chrome/browser/performance_monitor/performance_monitor_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/test/base/in_process_browser_test.h" 5 #include "chrome/test/base/in_process_browser_test.h"
6 6
7 #include "base/file_path.h" 7 #include "base/file_path.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "base/threading/sequenced_worker_pool.h" 10 #include "base/threading/sequenced_worker_pool.h"
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 base::Time(), base::Time::FromInternalValue(kint64max)); 151 base::Time(), base::Time::FromInternalValue(kint64max));
152 } 152 }
153 153
154 // A handle for getting the events from the database, which must be done on 154 // A handle for getting the events from the database, which must be done on
155 // the background thread. Since we are testing, we can mock synchronicity 155 // the background thread. Since we are testing, we can mock synchronicity
156 // with FlushForTesting(). 156 // with FlushForTesting().
157 std::vector<linked_ptr<Event> > GetEvents() { 157 std::vector<linked_ptr<Event> > GetEvents() {
158 // Ensure that any event insertions happen prior to getting events in order 158 // Ensure that any event insertions happen prior to getting events in order
159 // to avoid race conditions. 159 // to avoid race conditions.
160 content::BrowserThread::GetBlockingPool()->FlushForTesting(); 160 content::BrowserThread::GetBlockingPool()->FlushForTesting();
161 ui_test_utils::RunAllPendingInMessageLoop(); 161 content::RunAllPendingInMessageLoop();
162 162
163 std::vector<linked_ptr<Event> > events; 163 std::vector<linked_ptr<Event> > events;
164 content::BrowserThread::PostBlockingPoolSequencedTask( 164 content::BrowserThread::PostBlockingPoolSequencedTask(
165 Database::kDatabaseSequenceToken, 165 Database::kDatabaseSequenceToken,
166 FROM_HERE, 166 FROM_HERE,
167 base::Bind(&PerformanceMonitorBrowserTest::GetEventsOnBackgroundThread, 167 base::Bind(&PerformanceMonitorBrowserTest::GetEventsOnBackgroundThread,
168 base::Unretained(this), 168 base::Unretained(this),
169 &events)); 169 &events));
170 170
171 content::BrowserThread::GetBlockingPool()->FlushForTesting(); 171 content::BrowserThread::GetBlockingPool()->FlushForTesting();
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 DISABLED_RendererCrashEvent) { 415 DISABLED_RendererCrashEvent) {
416 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUICrashURL)); 416 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUICrashURL));
417 417
418 std::vector<linked_ptr<Event> > events = GetEvents(); 418 std::vector<linked_ptr<Event> > events = GetEvents();
419 ASSERT_EQ(1u, events.size()); 419 ASSERT_EQ(1u, events.size());
420 420
421 CheckEventType(EVENT_RENDERER_CRASH, events[0]); 421 CheckEventType(EVENT_RENDERER_CRASH, events[0]);
422 } 422 }
423 423
424 } // namespace performance_monitor 424 } // namespace performance_monitor
OLDNEW
« no previous file with comments | « chrome/browser/metrics/metrics_service_browsertest.cc ('k') | chrome/browser/printing/printing_layout_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698