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 5876 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5887 base::Closure reply = | 5887 base::Closure reply = |
5888 base::Bind(SendSuccessReply, AsWeakPtr(), reply_message); | 5888 base::Bind(SendSuccessReply, AsWeakPtr(), reply_message); |
5889 g_browser_process->policy_service()->RefreshPolicies( | 5889 g_browser_process->policy_service()->RefreshPolicies( |
5890 base::Bind(PostTask, BrowserThread::IO, | 5890 base::Bind(PostTask, BrowserThread::IO, |
5891 base::Bind(PostTask, BrowserThread::FILE, | 5891 base::Bind(PostTask, BrowserThread::FILE, |
5892 base::Bind(PostTask, BrowserThread::IO, | 5892 base::Bind(PostTask, BrowserThread::IO, |
5893 base::Bind(PostTask, BrowserThread::UI, reply))))); | 5893 base::Bind(PostTask, BrowserThread::UI, reply))))); |
5894 #endif | 5894 #endif |
5895 } | 5895 } |
5896 | 5896 |
5897 static int AccessArray(const int arr[], int index) { | 5897 static int AccessArray(const volatile int arr[], const volatile int *index) { |
5898 return arr[index]; | 5898 return arr[*index]; |
5899 } | 5899 } |
5900 | 5900 |
5901 void TestingAutomationProvider::SimulateAsanMemoryBug( | 5901 void TestingAutomationProvider::SimulateAsanMemoryBug( |
5902 base::DictionaryValue* args, IPC::Message* reply_message) { | 5902 base::DictionaryValue* args, IPC::Message* reply_message) { |
5903 int testarray[41]; | 5903 // This array is volatile not to let compiler optimize us out. |
5904 AccessArray(testarray, 42); | 5904 volatile int testarray[3] = {0, 0, 0}; |
| 5905 |
| 5906 // Send the reply while we can. |
5905 AutomationJSONReply(this, reply_message).SendSuccess(NULL); | 5907 AutomationJSONReply(this, reply_message).SendSuccess(NULL); |
| 5908 |
| 5909 // Cause Address Sanitizer to abort this process. |
| 5910 volatile int index = 5; |
| 5911 AccessArray(testarray, &index); |
5906 } | 5912 } |
5907 | 5913 |
5908 void TestingAutomationProvider::GetIndicesFromTab( | 5914 void TestingAutomationProvider::GetIndicesFromTab( |
5909 DictionaryValue* args, | 5915 DictionaryValue* args, |
5910 IPC::Message* reply_message) { | 5916 IPC::Message* reply_message) { |
5911 AutomationJSONReply reply(this, reply_message); | 5917 AutomationJSONReply reply(this, reply_message); |
5912 int id_or_handle = 0; | 5918 int id_or_handle = 0; |
5913 bool has_id = args->HasKey("tab_id"); | 5919 bool has_id = args->HasKey("tab_id"); |
5914 bool has_handle = args->HasKey("tab_handle"); | 5920 bool has_handle = args->HasKey("tab_handle"); |
5915 if (has_id && has_handle) { | 5921 if (has_id && has_handle) { |
(...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6573 | 6579 |
6574 void TestingAutomationProvider::WaitForProcessLauncherThreadToGoIdle( | 6580 void TestingAutomationProvider::WaitForProcessLauncherThreadToGoIdle( |
6575 IPC::Message* reply_message) { | 6581 IPC::Message* reply_message) { |
6576 new WaitForProcessLauncherThreadToGoIdleObserver(this, reply_message); | 6582 new WaitForProcessLauncherThreadToGoIdleObserver(this, reply_message); |
6577 } | 6583 } |
6578 | 6584 |
6579 void TestingAutomationProvider::OnRemoveProvider() { | 6585 void TestingAutomationProvider::OnRemoveProvider() { |
6580 if (g_browser_process) | 6586 if (g_browser_process) |
6581 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); | 6587 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); |
6582 } | 6588 } |
OLD | NEW |