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

Side by Side Diff: chrome/browser/history/history_browsertest.cc

Issue 10822030: Move ui_test_utils::RunMessageLoop to test_utils so that it can be reused by content_browsertests. (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 <vector> 5 #include <vector>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 public: 60 public:
61 explicit HistoryEnumerator(HistoryService* history) { 61 explicit HistoryEnumerator(HistoryService* history) {
62 EXPECT_TRUE(history); 62 EXPECT_TRUE(history);
63 if (!history) 63 if (!history)
64 return; 64 return;
65 65
66 BrowserThread::PostTask( 66 BrowserThread::PostTask(
67 BrowserThread::UI, 67 BrowserThread::UI,
68 FROM_HERE, 68 FROM_HERE,
69 base::Bind(&HistoryService::IterateURLs, history, this)); 69 base::Bind(&HistoryService::IterateURLs, history, this));
70 ui_test_utils::RunMessageLoop(); 70 content::RunMessageLoop();
71 } 71 }
72 72
73 virtual void OnURL(const GURL& url) { 73 virtual void OnURL(const GURL& url) {
74 urls_.push_back(url); 74 urls_.push_back(url);
75 } 75 }
76 76
77 virtual void OnComplete(bool success) { 77 virtual void OnComplete(bool success) {
78 BrowserThread::PostTask( 78 BrowserThread::PostTask(
79 BrowserThread::UI, 79 BrowserThread::UI,
80 FROM_HERE, 80 FROM_HERE,
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 } 122 }
123 123
124 void WaitForHistoryBackendToRun() { 124 void WaitForHistoryBackendToRun() {
125 CancelableRequestConsumerTSimple<int> request_consumer; 125 CancelableRequestConsumerTSimple<int> request_consumer;
126 scoped_refptr<HistoryDBTask> task(new WaitForHistoryTask()); 126 scoped_refptr<HistoryDBTask> task(new WaitForHistoryTask());
127 HistoryService* history = GetHistoryService(); 127 HistoryService* history = GetHistoryService();
128 BrowserThread::PostTask(BrowserThread::UI, 128 BrowserThread::PostTask(BrowserThread::UI,
129 FROM_HERE, 129 FROM_HERE,
130 base::Bind(&HistoryService::ScheduleDBTask, 130 base::Bind(&HistoryService::ScheduleDBTask,
131 history, task, &request_consumer)); 131 history, task, &request_consumer));
132 ui_test_utils::RunMessageLoop(); 132 content::RunMessageLoop();
133 } 133 }
134 134
135 void ExpectEmptyHistory() { 135 void ExpectEmptyHistory() {
136 std::vector<GURL> urls(GetHistoryContents()); 136 std::vector<GURL> urls(GetHistoryContents());
137 EXPECT_EQ(0U, urls.size()); 137 EXPECT_EQ(0U, urls.size());
138 } 138 }
139 139
140 void LoadAndWaitForURL(const GURL& url) { 140 void LoadAndWaitForURL(const GURL& url) {
141 string16 expected_title(ASCIIToUTF16("OK")); 141 string16 expected_title(ASCIIToUTF16("OK"));
142 content::TitleWatcher title_watcher( 142 content::TitleWatcher title_watcher(
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 // Mainly, this is to ensure we send a synchronous message to the renderer 303 // Mainly, this is to ensure we send a synchronous message to the renderer
304 // so that we're not susceptible (less susceptible?) to a race condition. 304 // so that we're not susceptible (less susceptible?) to a race condition.
305 // Should a race condition ever trigger, it won't result in flakiness. 305 // Should a race condition ever trigger, it won't result in flakiness.
306 int num = ui_test_utils::FindInPage( 306 int num = ui_test_utils::FindInPage(
307 chrome::GetActiveTabContents(browser()), ASCIIToUTF16("<img"), true, 307 chrome::GetActiveTabContents(browser()), ASCIIToUTF16("<img"), true,
308 true, NULL); 308 true, NULL);
309 EXPECT_GT(num, 0); 309 EXPECT_GT(num, 0);
310 EXPECT_EQ(ASCIIToUTF16("History"), 310 EXPECT_EQ(ASCIIToUTF16("History"),
311 chrome::GetActiveWebContents(browser())->GetTitle()); 311 chrome::GetActiveWebContents(browser())->GetTitle());
312 } 312 }
OLDNEW
« no previous file with comments | « chrome/browser/geolocation/geolocation_browsertest.cc ('k') | chrome/browser/history/redirect_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698