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

Side by Side Diff: chrome/test/base/javascript_test_observer.h

Issue 157713002: Switch DomAutomationController to be a RenderFrameObserver. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nasko@ CR feedback Created 6 years, 10 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 #ifndef CHROME_TEST_BASE_JAVASCRIPT_TEST_OBSERVER_H_ 5 #ifndef CHROME_TEST_BASE_JAVASCRIPT_TEST_OBSERVER_H_
6 #define CHROME_TEST_BASE_JAVASCRIPT_TEST_OBSERVER_H_ 6 #define CHROME_TEST_BASE_JAVASCRIPT_TEST_OBSERVER_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
11 #include "content/public/browser/notification_observer.h" 11 #include "content/public/browser/notification_observer.h"
12 #include "content/public/browser/notification_registrar.h" 12 #include "content/public/browser/notification_registrar.h"
13 13
14 namespace base { 14 namespace base {
15 class DictionaryValue; 15 class DictionaryValue;
16 } 16 }
17 17
18 namespace content { 18 namespace content {
19 class RenderViewHost; 19 class WebContents;
20 } 20 }
21 21
22 // Base class for handling a stream of automation messages produced by a 22 // Base class for handling a stream of automation messages produced by a
23 // JavascriptTestObserver. 23 // JavascriptTestObserver.
24 class TestMessageHandler { 24 class TestMessageHandler {
25 public: 25 public:
26 enum MessageResponse { 26 enum MessageResponse {
27 // Reset the timeout and keep running. 27 // Reset the timeout and keep running.
28 CONTINUE, 28 CONTINUE,
29 // Stop runnning. 29 // Stop runnning.
(...skipping 24 matching lines...) Expand all
54 std::string error_message_; 54 std::string error_message_;
55 }; 55 };
56 56
57 // This class captures a stream of automation messages coming from a Javascript 57 // This class captures a stream of automation messages coming from a Javascript
58 // test and dispatches them to a message handler. 58 // test and dispatches them to a message handler.
59 class JavascriptTestObserver : public content::NotificationObserver { 59 class JavascriptTestObserver : public content::NotificationObserver {
60 public: 60 public:
61 // The observer does not own any arguments passed to it. It is assumed that 61 // The observer does not own any arguments passed to it. It is assumed that
62 // the arguments will outlive all uses of the observer. 62 // the arguments will outlive all uses of the observer.
63 JavascriptTestObserver( 63 JavascriptTestObserver(
64 content::RenderViewHost* render_view_host, 64 content::WebContents* web_contents,
65 TestMessageHandler* handler); 65 TestMessageHandler* handler);
66 66
67 virtual ~JavascriptTestObserver(); 67 virtual ~JavascriptTestObserver();
68 68
69 // Pump the message loop until the message handler indicates the Javascript 69 // Pump the message loop until the message handler indicates the Javascript
70 // test is done running. Return true if the test jig functioned correctly and 70 // test is done running. Return true if the test jig functioned correctly and
71 // nothing timed out. 71 // nothing timed out.
72 bool Run(); 72 bool Run();
73 73
74 // Prepare the observer to be used again. This method should NOT be called 74 // Prepare the observer to be used again. This method should NOT be called
(...skipping 14 matching lines...) Expand all
89 89
90 TestMessageHandler* handler_; 90 TestMessageHandler* handler_;
91 bool running_; 91 bool running_;
92 bool finished_; 92 bool finished_;
93 content::NotificationRegistrar registrar_; 93 content::NotificationRegistrar registrar_;
94 94
95 DISALLOW_COPY_AND_ASSIGN(JavascriptTestObserver); 95 DISALLOW_COPY_AND_ASSIGN(JavascriptTestObserver);
96 }; 96 };
97 97
98 #endif // CHROME_TEST_BASE_JAVASCRIPT_TEST_OBSERVER_H_ 98 #endif // CHROME_TEST_BASE_JAVASCRIPT_TEST_OBSERVER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698