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

Side by Side Diff: chrome/test/ui_test_utils.cc

Issue 339009: GMocking Externaltab tests. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 1 month 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
« no previous file with comments | « chrome/test/ui_test_utils.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/ui_test_utils.h" 5 #include "chrome/test/ui_test_utils.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/json/json_reader.h" 9 #include "base/json/json_reader.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 void RegisterAndWait(NotificationType::Type type, 496 void RegisterAndWait(NotificationType::Type type,
497 NotificationObserver* observer, 497 NotificationObserver* observer,
498 int64 timeout_ms) { 498 int64 timeout_ms) {
499 NotificationRegistrar registrar; 499 NotificationRegistrar registrar;
500 registrar.Add(observer, type, NotificationService::AllSources()); 500 registrar.Add(observer, type, NotificationService::AllSources());
501 MessageLoop::current()->PostDelayedTask( 501 MessageLoop::current()->PostDelayedTask(
502 FROM_HERE, new MessageLoop::QuitTask, timeout_ms); 502 FROM_HERE, new MessageLoop::QuitTask, timeout_ms);
503 RunMessageLoop(); 503 RunMessageLoop();
504 } 504 }
505 505
506 TimedMessageLoopRunner::TimedMessageLoopRunner()
507 : loop_(new MessageLoopForUI()),
508 owned_(true) {
509 }
510
511 TimedMessageLoopRunner::~TimedMessageLoopRunner() {
512 if (owned_)
513 delete loop_;
514 }
515
516 void TimedMessageLoopRunner::RunFor(int ms) {
517 QuitAfter(ms);
518 loop_->Run();
519 }
520
521 void TimedMessageLoopRunner::Quit() {
522 loop_->PostTask(FROM_HERE, new MessageLoop::QuitTask);
523 }
524
525 void TimedMessageLoopRunner::QuitAfter(int ms) {
526 loop_->PostDelayedTask(FROM_HERE, new MessageLoop::QuitTask, ms);
527 }
528
506 } // namespace ui_test_utils 529 } // namespace ui_test_utils
OLDNEW
« no previous file with comments | « chrome/test/ui_test_utils.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698