| OLD | NEW |
| 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 int number_of_navigations_; | 76 int number_of_navigations_; |
| 77 | 77 |
| 78 DISALLOW_COPY_AND_ASSIGN(NavigationNotificationObserver); | 78 DISALLOW_COPY_AND_ASSIGN(NavigationNotificationObserver); |
| 79 }; | 79 }; |
| 80 | 80 |
| 81 class DOMOperationObserver : public NotificationObserver { | 81 class DOMOperationObserver : public NotificationObserver { |
| 82 public: | 82 public: |
| 83 explicit DOMOperationObserver(RenderViewHost* render_view_host) { | 83 explicit DOMOperationObserver(RenderViewHost* render_view_host) { |
| 84 registrar_.Add(this, NotificationType::DOM_OPERATION_RESPONSE, | 84 registrar_.Add(this, NotificationType::DOM_OPERATION_RESPONSE, |
| 85 Source<RenderViewHost>(render_view_host)); | 85 Source<RenderViewHost>(render_view_host)); |
| 86 RunMessageLoop(); | 86 ui_test_utils::RunMessageLoop(); |
| 87 } | 87 } |
| 88 | 88 |
| 89 virtual void Observe(NotificationType type, | 89 virtual void Observe(NotificationType type, |
| 90 const NotificationSource& source, | 90 const NotificationSource& source, |
| 91 const NotificationDetails& details) { | 91 const NotificationDetails& details) { |
| 92 DCHECK(type == NotificationType::DOM_OPERATION_RESPONSE); | 92 DCHECK(type == NotificationType::DOM_OPERATION_RESPONSE); |
| 93 Details<DomOperationNotificationDetails> dom_op_details(details); | 93 Details<DomOperationNotificationDetails> dom_op_details(details); |
| 94 response_ = dom_op_details->json(); | 94 response_ = dom_op_details->json(); |
| 95 MessageLoopForUI::current()->Quit(); | 95 MessageLoopForUI::current()->Quit(); |
| 96 } | 96 } |
| (...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 } // namespace ui_test_utils | 506 } // namespace ui_test_utils |
| OLD | NEW |