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

Side by Side Diff: chrome/test/webdriver/webdriver_session.cc

Issue 10828135: Allow popups, mouselock, and https media-stream content by default. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 4 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
« no previous file with comments | « chrome/test/webdriver/webdriver_automation.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "chrome/test/webdriver/webdriver_session.h" 5 #include "chrome/test/webdriver/webdriver_session.h"
6 6
7 #include <sstream> 7 #include <sstream>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 } 104 }
105 logger_.set_min_log_level(capabilities_.log_levels[LogType::kDriver]); 105 logger_.set_min_log_level(capabilities_.log_levels[LogType::kDriver]);
106 106
107 Automation::BrowserOptions browser_options; 107 Automation::BrowserOptions browser_options;
108 browser_options.command = capabilities_.command; 108 browser_options.command = capabilities_.command;
109 browser_options.channel_id = capabilities_.channel; 109 browser_options.channel_id = capabilities_.channel;
110 browser_options.detach_process = capabilities_.detach; 110 browser_options.detach_process = capabilities_.detach;
111 browser_options.user_data_dir = capabilities_.profile; 111 browser_options.user_data_dir = capabilities_.profile;
112 if (!capabilities_.no_website_testing_defaults) { 112 if (!capabilities_.no_website_testing_defaults) {
113 browser_options.ignore_certificate_errors = true; 113 browser_options.ignore_certificate_errors = true;
114 browser_options.disable_popup_blocking = true;
115 } 114 }
116 RunSessionTask(base::Bind( 115 RunSessionTask(base::Bind(
117 &Session::InitOnSessionThread, 116 &Session::InitOnSessionThread,
118 base::Unretained(this), 117 base::Unretained(this),
119 browser_options, 118 browser_options,
120 &build_no_, 119 &build_no_,
121 &error)); 120 &error));
122 if (!error) 121 if (!error)
123 error = PostBrowserStartInit(); 122 error = PostBrowserStartInit();
124 123
(...skipping 1768 matching lines...) Expand 10 before | Expand all | Expand 10 after
1893 return error; 1892 return error;
1894 1893
1895 // Disable checking for SSL certificate revocation. 1894 // Disable checking for SSL certificate revocation.
1896 error = SetPreference( 1895 error = SetPreference(
1897 "ssl.rev_checking.enabled", 1896 "ssl.rev_checking.enabled",
1898 false /* is_user_pref */, 1897 false /* is_user_pref */,
1899 Value::CreateBooleanValue(false)); 1898 Value::CreateBooleanValue(false));
1900 if (error) 1899 if (error)
1901 return error; 1900 return error;
1902 1901
1903 // Allow certain content by default. 1902 // Allow content by default.
1903 // Media-stream cannot be enabled by default; we must specify
1904 // particular host patterns and devices.
1905 DictionaryValue* devices = new DictionaryValue();
1906 devices->SetString("audio", "Default");
1907 devices->SetString("video", "Default");
1908 DictionaryValue* content_settings = new DictionaryValue();
1909 content_settings->Set("media-stream", devices);
1910 DictionaryValue* pattern_pairs = new DictionaryValue();
1911 pattern_pairs->Set("https://*,*", content_settings);
1912 error = SetPreference(
1913 "profile.content_settings.pattern_pairs",
1914 true /* is_user_pref */,
1915 pattern_pairs);
1916 if (error)
1917 return error;
1904 const int kAllowContent = 1; 1918 const int kAllowContent = 1;
1905 DictionaryValue* default_content_settings = new DictionaryValue(); 1919 DictionaryValue* default_content_settings = new DictionaryValue();
1906 default_content_settings->SetInteger("geolocation", kAllowContent); 1920 default_content_settings->SetInteger("geolocation", kAllowContent);
1921 default_content_settings->SetInteger("mouselock", kAllowContent);
1907 default_content_settings->SetInteger("notifications", kAllowContent); 1922 default_content_settings->SetInteger("notifications", kAllowContent);
1923 default_content_settings->SetInteger("popups", kAllowContent);
1908 return SetPreference( 1924 return SetPreference(
1909 "profile.default_content_settings", 1925 "profile.default_content_settings",
1910 true /* is_user_pref */, 1926 true /* is_user_pref */,
1911 default_content_settings); 1927 default_content_settings);
1912 } 1928 }
1913 1929
1914 Error* Session::SetPrefs() { 1930 Error* Session::SetPrefs() {
1915 DictionaryValue::key_iterator iter = capabilities_.prefs->begin_keys(); 1931 DictionaryValue::key_iterator iter = capabilities_.prefs->begin_keys();
1916 for (; iter != capabilities_.prefs->end_keys(); ++iter) { 1932 for (; iter != capabilities_.prefs->end_keys(); ++iter) {
1917 Value* value; 1933 Value* value;
1918 capabilities_.prefs->GetWithoutPathExpansion(*iter, &value); 1934 capabilities_.prefs->GetWithoutPathExpansion(*iter, &value);
1919 Error* error = SetPreference(*iter, true /* is_user_pref */, 1935 Error* error = SetPreference(*iter, true /* is_user_pref */,
1920 value->DeepCopy()); 1936 value->DeepCopy());
1921 if (error) 1937 if (error)
1922 return error; 1938 return error;
1923 } 1939 }
1924 iter = capabilities_.local_state->begin_keys(); 1940 iter = capabilities_.local_state->begin_keys();
1925 for (; iter != capabilities_.local_state->end_keys(); ++iter) { 1941 for (; iter != capabilities_.local_state->end_keys(); ++iter) {
1926 Value* value; 1942 Value* value;
1927 capabilities_.local_state->GetWithoutPathExpansion(*iter, &value); 1943 capabilities_.local_state->GetWithoutPathExpansion(*iter, &value);
1928 Error* error = SetPreference(*iter, false /* is_user_pref */, 1944 Error* error = SetPreference(*iter, false /* is_user_pref */,
1929 value->DeepCopy()); 1945 value->DeepCopy());
1930 if (error) 1946 if (error)
1931 return error; 1947 return error;
1932 } 1948 }
1933 return NULL; 1949 return NULL;
1934 } 1950 }
1935 1951
1936 } // namespace webdriver 1952 } // namespace webdriver
OLDNEW
« no previous file with comments | « chrome/test/webdriver/webdriver_automation.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698