summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/automation/automation_profile_impl.cc36
-rw-r--r--chrome/browser/net/chrome_url_request_context.cc23
-rw-r--r--chrome/browser/net/chrome_url_request_context.h3
-rw-r--r--chrome/test/automation/automation_proxy_uitest.cc3
4 files changed, 51 insertions, 14 deletions
diff --git a/chrome/browser/automation/automation_profile_impl.cc b/chrome/browser/automation/automation_profile_impl.cc
index 02e2cc1..1cba8d6 100644
--- a/chrome/browser/automation/automation_profile_impl.cc
+++ b/chrome/browser/automation/automation_profile_impl.cc
@@ -3,27 +3,37 @@
// found in the LICENSE file.
#include "chrome/browser/automation/automation_profile_impl.h"
+#include "chrome/browser/net/chrome_url_request_context.h"
#include "chrome/test/automation/automation_messages.h"
-#include "net/url_request/url_request_context.h"
// A special Request context for automation. Substitute a few things
// like cookie store, proxy settings etc to handle them differently
// for automation.
-class AutomationURLRequestContext : public URLRequestContext {
+class AutomationURLRequestContext : public ChromeURLRequestContext {
public:
AutomationURLRequestContext(URLRequestContext* original_context,
- net::CookieStore* automation_cookie_store) {
- host_resolver_ = original_context->host_resolver();
- proxy_service_ = original_context->proxy_service();
- http_transaction_factory_ = original_context->http_transaction_factory();
- ftp_transaction_factory_ = original_context->ftp_transaction_factory();
+ net::CookieStore* automation_cookie_store)
+ // All URLRequestContexts in chrome extend from ChromeURLRequestContext
+ : ChromeURLRequestContext(static_cast<ChromeURLRequestContext*>(
+ original_context)) {
cookie_store_ = automation_cookie_store;
- cookie_policy_.set_type(original_context->cookie_policy()->type());
- force_tls_state_ = original_context->force_tls_state();
- // ftp_auth_cache_ = original_context->ftp_auth_cache();
- accept_language_ = original_context->accept_language();
- accept_charset_ = original_context->accept_charset();
- referrer_charset_ = original_context->referrer_charset();
+ }
+
+ ~AutomationURLRequestContext() {
+ // Clear out members before calling base class dtor since we don't
+ // own any of them.
+
+ // Clear URLRequestContext members.
+ host_resolver_ = NULL;
+ proxy_service_ = NULL;
+ http_transaction_factory_ = NULL;
+ ftp_transaction_factory_ = NULL;
+ cookie_store_ = NULL;
+ force_tls_state_ = NULL;
+
+ // Clear ChromeURLRequestContext members.
+ prefs_ = NULL;
+ blacklist_ = NULL;
}
private:
diff --git a/chrome/browser/net/chrome_url_request_context.cc b/chrome/browser/net/chrome_url_request_context.cc
index 7130b45..f6df4a2 100644
--- a/chrome/browser/net/chrome_url_request_context.cc
+++ b/chrome/browser/net/chrome_url_request_context.cc
@@ -324,6 +324,29 @@ ChromeURLRequestContext::ChromeURLRequestContext(Profile* profile)
}
}
+ChromeURLRequestContext::ChromeURLRequestContext(
+ ChromeURLRequestContext* other) {
+ // Set URLRequestContext members
+ host_resolver_ = other->host_resolver_;
+ proxy_service_ = other->proxy_service_;
+ http_transaction_factory_ = other->http_transaction_factory_;
+ ftp_transaction_factory_ = other->ftp_transaction_factory_;
+ cookie_store_ = other->cookie_store_;
+ cookie_policy_.set_type(other->cookie_policy_.type());
+ force_tls_state_ = other->force_tls_state_;
+ accept_language_ = other->accept_language_;
+ accept_charset_ = other->accept_charset_;
+ referrer_charset_ = other->referrer_charset_;
+
+ // Set ChromeURLRequestContext members
+ extension_paths_ = other->extension_paths_;
+ user_script_dir_path_ = other->user_script_dir_path_;
+ prefs_ = other->prefs_;
+ blacklist_ = other->blacklist_;
+ is_media_ = other->is_media_;
+ is_off_the_record_ = other->is_off_the_record_;
+}
+
// NotificationObserver implementation.
void ChromeURLRequestContext::Observe(NotificationType type,
const NotificationSource& source,
diff --git a/chrome/browser/net/chrome_url_request_context.h b/chrome/browser/net/chrome_url_request_context.h
index debee5c..f4baea6 100644
--- a/chrome/browser/net/chrome_url_request_context.h
+++ b/chrome/browser/net/chrome_url_request_context.h
@@ -74,10 +74,11 @@ class ChromeURLRequestContext : public URLRequestContext,
// Gets the Privacy Blacklist, if any for this context.
const Blacklist* blacklist() const { return blacklist_; }
-private:
+ protected:
// Private constructor, use the static factory methods instead. This is
// expected to be called on the UI thread.
ChromeURLRequestContext(Profile* profile);
+ ChromeURLRequestContext(ChromeURLRequestContext* other);
// Create a request context for media resources from a regular request
// context. This helper method is called from CreateOriginalForMedia and
diff --git a/chrome/test/automation/automation_proxy_uitest.cc b/chrome/test/automation/automation_proxy_uitest.cc
index 02e77f7..75395af 100644
--- a/chrome/test/automation/automation_proxy_uitest.cc
+++ b/chrome/test/automation/automation_proxy_uitest.cc
@@ -811,6 +811,7 @@ TEST_F(ExternalTabTestType, IncognitoMode) {
gfx::Rect(),
WS_POPUP,
true,
+ false,
false
};
HWND external_tab_container = NULL;
@@ -849,6 +850,7 @@ TEST_F(ExternalTabTestType, ExternalTabPostMessage) {
gfx::Rect(),
WS_POPUP,
false,
+ false,
false
};
HWND external_tab_container = NULL;
@@ -892,6 +894,7 @@ TEST_F(ExternalTabTestType, ExternalTabPostMessageTarget) {
gfx::Rect(),
WS_POPUP,
false,
+ false,
false
};
HWND external_tab_container = NULL;