| OLD | NEW |
| 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 "content/public/test/browser_test_utils.h" | 5 #include "content/public/test/browser_test_utils.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/json/json_reader.h" | 8 #include "base/json/json_reader.h" |
| 9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
| 10 #include "base/process/kill.h" | 10 #include "base/process/kill.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 namespace content { | 37 namespace content { |
| 38 namespace { | 38 namespace { |
| 39 | 39 |
| 40 class DOMOperationObserver : public NotificationObserver, | 40 class DOMOperationObserver : public NotificationObserver, |
| 41 public WebContentsObserver { | 41 public WebContentsObserver { |
| 42 public: | 42 public: |
| 43 explicit DOMOperationObserver(RenderViewHost* rvh) | 43 explicit DOMOperationObserver(RenderViewHost* rvh) |
| 44 : WebContentsObserver(WebContents::FromRenderViewHost(rvh)), | 44 : WebContentsObserver(WebContents::FromRenderViewHost(rvh)), |
| 45 did_respond_(false) { | 45 did_respond_(false) { |
| 46 registrar_.Add(this, NOTIFICATION_DOM_OPERATION_RESPONSE, | 46 registrar_.Add(this, NOTIFICATION_DOM_OPERATION_RESPONSE, |
| 47 Source<RenderViewHost>(rvh)); | 47 Source<WebContents>(web_contents())); |
| 48 message_loop_runner_ = new MessageLoopRunner; | 48 message_loop_runner_ = new MessageLoopRunner; |
| 49 } | 49 } |
| 50 | 50 |
| 51 virtual void Observe(int type, | 51 virtual void Observe(int type, |
| 52 const NotificationSource& source, | 52 const NotificationSource& source, |
| 53 const NotificationDetails& details) OVERRIDE { | 53 const NotificationDetails& details) OVERRIDE { |
| 54 DCHECK(type == NOTIFICATION_DOM_OPERATION_RESPONSE); | 54 DCHECK(type == NOTIFICATION_DOM_OPERATION_RESPONSE); |
| 55 Details<DomOperationNotificationDetails> dom_op_details(details); | 55 Details<DomOperationNotificationDetails> dom_op_details(details); |
| 56 response_ = dom_op_details->json; | 56 response_ = dom_op_details->json; |
| 57 did_respond_ = true; | 57 did_respond_ = true; |
| (...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 675 // The queue should not be empty, unless we were quit because of a timeout. | 675 // The queue should not be empty, unless we were quit because of a timeout. |
| 676 if (message_queue_.empty()) | 676 if (message_queue_.empty()) |
| 677 return false; | 677 return false; |
| 678 if (message) | 678 if (message) |
| 679 *message = message_queue_.front(); | 679 *message = message_queue_.front(); |
| 680 message_queue_.pop(); | 680 message_queue_.pop(); |
| 681 return true; | 681 return true; |
| 682 } | 682 } |
| 683 | 683 |
| 684 } // namespace content | 684 } // namespace content |
| OLD | NEW |