OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 CONTENT_PUBLIC_TEST_JAVASCRIPT_TEST_OBSERVER_H_ | 5 #ifndef CONTENT_PUBLIC_TEST_JAVASCRIPT_TEST_OBSERVER_H_ |
6 #define CONTENT_PUBLIC_TEST_JAVASCRIPT_TEST_OBSERVER_H_ | 6 #define CONTENT_PUBLIC_TEST_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 WebContents; | 19 class WebContents; |
20 | 20 |
21 // Base class for handling a stream of automation messages produced by a | 21 // Base class for handling a stream of automation messages produced by a |
22 // JavascriptTestObserver. | 22 // JavascriptTestObserver. |
23 class TestMessageHandler { | 23 class TestMessageHandler { |
24 public: | 24 public: |
25 enum MessageResponse { | 25 enum MessageResponse { |
26 // Reset the timeout and keep running. | 26 // Reset the timeout and keep running. |
27 CONTINUE, | 27 CONTINUE, |
28 // Stop runnning. | 28 // Stop running. |
29 DONE | 29 DONE |
30 }; | 30 }; |
31 | 31 |
32 TestMessageHandler(); | 32 TestMessageHandler(); |
33 virtual ~TestMessageHandler(); | 33 virtual ~TestMessageHandler(); |
34 | 34 |
35 // Called when a message is received from the DOM automation controller. | 35 // Called when a message is received from the DOM automation controller. |
36 virtual MessageResponse HandleMessage(const std::string& json) = 0; | 36 virtual MessageResponse HandleMessage(const std::string& json) = 0; |
37 | 37 |
38 void SetError(const std::string& message); | 38 void SetError(const std::string& message); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 bool running_; | 88 bool running_; |
89 bool finished_; | 89 bool finished_; |
90 NotificationRegistrar registrar_; | 90 NotificationRegistrar registrar_; |
91 | 91 |
92 DISALLOW_COPY_AND_ASSIGN(JavascriptTestObserver); | 92 DISALLOW_COPY_AND_ASSIGN(JavascriptTestObserver); |
93 }; | 93 }; |
94 | 94 |
95 } // namespace content | 95 } // namespace content |
96 | 96 |
97 #endif // CONTENT_PUBLIC_TEST_JAVASCRIPT_TEST_OBSERVER_H_ | 97 #endif // CONTENT_PUBLIC_TEST_JAVASCRIPT_TEST_OBSERVER_H_ |
OLD | NEW |