OLD | NEW |
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/browser/automation/testing_automation_provider.h" | 5 #include "chrome/browser/automation/testing_automation_provider.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 2240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2251 handler_map["UpdateExtensionsNow"] = | 2251 handler_map["UpdateExtensionsNow"] = |
2252 &TestingAutomationProvider::UpdateExtensionsNow; | 2252 &TestingAutomationProvider::UpdateExtensionsNow; |
2253 #if !defined(NO_TCMALLOC) && (defined(OS_LINUX) || defined(OS_CHROMEOS)) | 2253 #if !defined(NO_TCMALLOC) && (defined(OS_LINUX) || defined(OS_CHROMEOS)) |
2254 handler_map["HeapProfilerDump"] = | 2254 handler_map["HeapProfilerDump"] = |
2255 &TestingAutomationProvider::HeapProfilerDump; | 2255 &TestingAutomationProvider::HeapProfilerDump; |
2256 #endif // !defined(NO_TCMALLOC) && (defined(OS_LINUX) || defined(OS_CHROMEOS)) | 2256 #endif // !defined(NO_TCMALLOC) && (defined(OS_LINUX) || defined(OS_CHROMEOS)) |
2257 handler_map["OverrideGeoposition"] = | 2257 handler_map["OverrideGeoposition"] = |
2258 &TestingAutomationProvider::OverrideGeoposition; | 2258 &TestingAutomationProvider::OverrideGeoposition; |
2259 handler_map["AppendSwitchASCIIToCommandLine"] = | 2259 handler_map["AppendSwitchASCIIToCommandLine"] = |
2260 &TestingAutomationProvider::AppendSwitchASCIIToCommandLine; | 2260 &TestingAutomationProvider::AppendSwitchASCIIToCommandLine; |
| 2261 handler_map["SimulateAsanMemoryBug"] = |
| 2262 &TestingAutomationProvider::SimulateAsanMemoryBug; |
2261 | 2263 |
2262 #if defined(OS_CHROMEOS) | 2264 #if defined(OS_CHROMEOS) |
2263 handler_map["GetLoginInfo"] = &TestingAutomationProvider::GetLoginInfo; | 2265 handler_map["GetLoginInfo"] = &TestingAutomationProvider::GetLoginInfo; |
2264 handler_map["ShowCreateAccountUI"] = | 2266 handler_map["ShowCreateAccountUI"] = |
2265 &TestingAutomationProvider::ShowCreateAccountUI; | 2267 &TestingAutomationProvider::ShowCreateAccountUI; |
2266 handler_map["ExecuteJavascriptInOOBEWebUI"] = | 2268 handler_map["ExecuteJavascriptInOOBEWebUI"] = |
2267 &TestingAutomationProvider::ExecuteJavascriptInOOBEWebUI; | 2269 &TestingAutomationProvider::ExecuteJavascriptInOOBEWebUI; |
2268 handler_map["LoginAsGuest"] = &TestingAutomationProvider::LoginAsGuest; | 2270 handler_map["LoginAsGuest"] = &TestingAutomationProvider::LoginAsGuest; |
2269 handler_map["AddLoginEventObserver"] = | 2271 handler_map["AddLoginEventObserver"] = |
2270 &TestingAutomationProvider::AddLoginEventObserver; | 2272 &TestingAutomationProvider::AddLoginEventObserver; |
(...skipping 4105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6376 base::Closure reply = | 6378 base::Closure reply = |
6377 base::Bind(SendSuccessReply, AsWeakPtr(), reply_message); | 6379 base::Bind(SendSuccessReply, AsWeakPtr(), reply_message); |
6378 g_browser_process->policy_service()->RefreshPolicies( | 6380 g_browser_process->policy_service()->RefreshPolicies( |
6379 base::Bind(PostTask, BrowserThread::IO, | 6381 base::Bind(PostTask, BrowserThread::IO, |
6380 base::Bind(PostTask, BrowserThread::FILE, | 6382 base::Bind(PostTask, BrowserThread::FILE, |
6381 base::Bind(PostTask, BrowserThread::IO, | 6383 base::Bind(PostTask, BrowserThread::IO, |
6382 base::Bind(PostTask, BrowserThread::UI, reply))))); | 6384 base::Bind(PostTask, BrowserThread::UI, reply))))); |
6383 #endif | 6385 #endif |
6384 } | 6386 } |
6385 | 6387 |
| 6388 static int AccessArray(const int arr[], int index) { |
| 6389 return arr[index]; |
| 6390 } |
| 6391 |
| 6392 void TestingAutomationProvider::SimulateAsanMemoryBug( |
| 6393 base::DictionaryValue* args, IPC::Message* reply_message) { |
| 6394 int testarray[41]; |
| 6395 AccessArray(testarray, 42); |
| 6396 AutomationJSONReply(this, reply_message).SendSuccess(NULL); |
| 6397 } |
| 6398 |
6386 void TestingAutomationProvider::GetIndicesFromTab( | 6399 void TestingAutomationProvider::GetIndicesFromTab( |
6387 DictionaryValue* args, | 6400 DictionaryValue* args, |
6388 IPC::Message* reply_message) { | 6401 IPC::Message* reply_message) { |
6389 AutomationJSONReply reply(this, reply_message); | 6402 AutomationJSONReply reply(this, reply_message); |
6390 int id_or_handle = 0; | 6403 int id_or_handle = 0; |
6391 bool has_id = args->HasKey("tab_id"); | 6404 bool has_id = args->HasKey("tab_id"); |
6392 bool has_handle = args->HasKey("tab_handle"); | 6405 bool has_handle = args->HasKey("tab_handle"); |
6393 if (has_id && has_handle) { | 6406 if (has_id && has_handle) { |
6394 reply.SendError( | 6407 reply.SendError( |
6395 "Both 'tab_id' and 'tab_handle' were specified. Only one is allowed"); | 6408 "Both 'tab_id' and 'tab_handle' were specified. Only one is allowed"); |
(...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7112 *browser_handle = browser_tracker_->Add(browser); | 7125 *browser_handle = browser_tracker_->Add(browser); |
7113 *success = true; | 7126 *success = true; |
7114 } | 7127 } |
7115 } | 7128 } |
7116 } | 7129 } |
7117 | 7130 |
7118 void TestingAutomationProvider::OnRemoveProvider() { | 7131 void TestingAutomationProvider::OnRemoveProvider() { |
7119 if (g_browser_process) | 7132 if (g_browser_process) |
7120 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); | 7133 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); |
7121 } | 7134 } |
OLD | NEW |