OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 #ifndef CHROME_FRAME_TEST_NET_TEST_AUTOMATION_PROVIDER_H_ |
| 5 #define CHROME_FRAME_TEST_NET_TEST_AUTOMATION_PROVIDER_H_ |
| 6 |
| 7 #include "chrome/browser/automation/automation_provider.h" |
| 8 |
| 9 class TestAutomationResourceMessageFilter; |
| 10 |
| 11 // Callback interface for TestAutomationProvider. |
| 12 class TestAutomationProviderDelegate { |
| 13 public: |
| 14 virtual void OnInitialTabLoaded() = 0; |
| 15 }; |
| 16 |
| 17 // A slightly customized version of AutomationProvider. |
| 18 // We override AutomationProvider to be able to filter received messages |
| 19 // (see TestAutomationResourceMessageFilter) and know when the initial |
| 20 // ExternalTab has been loaded. |
| 21 // In order to intercept UrlRequests and make the URLRequestAutomationJob class |
| 22 // handle requests from unit tests, we also implement URLRequest::Interceptor. |
| 23 class TestAutomationProvider |
| 24 : public AutomationProvider, |
| 25 public URLRequest::Interceptor { |
| 26 public: |
| 27 explicit TestAutomationProvider(Profile* profile, |
| 28 TestAutomationProviderDelegate* delegate); |
| 29 |
| 30 virtual ~TestAutomationProvider(); |
| 31 |
| 32 // AutomationProvider overrides. |
| 33 virtual void OnMessageReceived(const IPC::Message& msg); |
| 34 virtual bool Send(IPC::Message* msg); |
| 35 |
| 36 // URLRequest::Interceptor. |
| 37 virtual URLRequestJob* MaybeIntercept(URLRequest* request); |
| 38 |
| 39 // Call to instantiate and initialize a new instance of |
| 40 // TestAutomationProvider. |
| 41 static TestAutomationProvider* NewAutomationProvider( |
| 42 Profile* p, |
| 43 const std::string& channel, |
| 44 TestAutomationProviderDelegate* delegate); |
| 45 |
| 46 protected: |
| 47 scoped_refptr<TestAutomationResourceMessageFilter> filter_; |
| 48 int tab_handle_; |
| 49 TestAutomationProviderDelegate* delegate_; |
| 50 }; |
| 51 |
| 52 #endif CHROME_FRAME_TEST_NET_TEST_AUTOMATION_PROVIDER_H_ |
OLD | NEW |