| 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 #ifndef CHROME_FRAME_TEST_NET_TEST_AUTOMATION_PROVIDER_H_ | 4 #ifndef CHROME_FRAME_TEST_NET_TEST_AUTOMATION_PROVIDER_H_ |
| 5 #define CHROME_FRAME_TEST_NET_TEST_AUTOMATION_PROVIDER_H_ | 5 #define CHROME_FRAME_TEST_NET_TEST_AUTOMATION_PROVIDER_H_ |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include "chrome/browser/automation/automation_provider.h" | 8 #include "chrome/browser/automation/automation_provider.h" |
| 9 | 9 |
| 10 namespace net { | 10 namespace net { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 // A slightly customized version of AutomationProvider. | 23 // A slightly customized version of AutomationProvider. |
| 24 // We override AutomationProvider to be able to filter received messages | 24 // We override AutomationProvider to be able to filter received messages |
| 25 // (see TestAutomationResourceMessageFilter) and know when the initial | 25 // (see TestAutomationResourceMessageFilter) and know when the initial |
| 26 // ExternalTab has been loaded. | 26 // ExternalTab has been loaded. |
| 27 // In order to intercept UrlRequests and make the URLRequestAutomationJob class | 27 // In order to intercept UrlRequests and make the URLRequestAutomationJob class |
| 28 // handle requests from unit tests, we register a protocol factory for | 28 // handle requests from unit tests, we register a protocol factory for |
| 29 // http/https. | 29 // http/https. |
| 30 class TestAutomationProvider | 30 class TestAutomationProvider |
| 31 : public AutomationProvider { | 31 : public AutomationProvider { |
| 32 public: | 32 public: |
| 33 explicit TestAutomationProvider(Profile* profile, | 33 TestAutomationProvider(Profile* profile, |
| 34 TestAutomationProviderDelegate* delegate); | 34 TestAutomationProviderDelegate* delegate); |
| 35 | 35 |
| 36 virtual ~TestAutomationProvider(); | 36 virtual ~TestAutomationProvider(); |
| 37 | 37 |
| 38 // AutomationProvider overrides. | 38 // AutomationProvider overrides. |
| 39 virtual bool OnMessageReceived(const IPC::Message& msg); | 39 virtual bool OnMessageReceived(const IPC::Message& msg); |
| 40 virtual bool Send(IPC::Message* msg); | 40 virtual bool Send(IPC::Message* msg); |
| 41 | 41 |
| 42 // Protocol factory for handling http/https requests over automation. | 42 // Protocol factory for handling http/https requests over automation. |
| 43 static net::URLRequestJob* Factory(net::URLRequest* request, | 43 static net::URLRequestJob* Factory(net::URLRequest* request, |
| 44 const std::string& scheme); | 44 const std::string& scheme); |
| 45 | 45 |
| 46 // Call to instantiate and initialize a new instance of | 46 // Call to instantiate and initialize a new instance of |
| 47 // TestAutomationProvider. | 47 // TestAutomationProvider. |
| 48 static TestAutomationProvider* NewAutomationProvider( | 48 static TestAutomationProvider* NewAutomationProvider( |
| 49 Profile* p, | 49 Profile* p, |
| 50 const std::string& channel, | 50 const std::string& channel, |
| 51 TestAutomationProviderDelegate* delegate); | 51 TestAutomationProviderDelegate* delegate); |
| 52 | 52 |
| 53 protected: | 53 protected: |
| 54 virtual std::string GetProtocolVersion(); | 54 virtual std::string GetProtocolVersion(); |
| 55 | 55 |
| 56 int tab_handle_; | 56 int tab_handle_; |
| 57 TestAutomationProviderDelegate* delegate_; | 57 TestAutomationProviderDelegate* delegate_; |
| 58 | 58 |
| 59 static TestAutomationProvider* g_provider_instance_; | 59 static TestAutomationProvider* g_provider_instance_; |
| 60 }; | 60 }; |
| 61 | 61 |
| 62 #endif // CHROME_FRAME_TEST_NET_TEST_AUTOMATION_PROVIDER_H_ | 62 #endif // CHROME_FRAME_TEST_NET_TEST_AUTOMATION_PROVIDER_H_ |
| OLD | NEW |