| Index: chrome/browser/automation/testing_automation_provider.cc | 
| diff --git a/chrome/browser/automation/testing_automation_provider.cc b/chrome/browser/automation/testing_automation_provider.cc | 
| index 012fb4922c3121bcfa754f7a63a1ea36ffb120fb..0dd3096cc1b39b3af0e102e2d945442f46161039 100644 | 
| --- a/chrome/browser/automation/testing_automation_provider.cc | 
| +++ b/chrome/browser/automation/testing_automation_provider.cc | 
| @@ -128,6 +128,8 @@ | 
| #include "content/public/browser/child_process_data.h" | 
| #include "content/public/browser/favicon_status.h" | 
| #include "content/public/browser/geolocation.h" | 
| +#include "content/public/browser/gpu_data_manager.h" | 
| +#include "content/public/browser/gpu_data_manager_observer.h" | 
| #include "content/public/browser/interstitial_page.h" | 
| #include "content/public/browser/interstitial_page_delegate.h" | 
| #include "content/public/browser/navigation_entry.h" | 
| @@ -1972,6 +1974,8 @@ void TestingAutomationProvider::BuildJSONHandlerMaps() { | 
| &TestingAutomationProvider::GetV8HeapStats; | 
| browser_handler_map_["GetFPS"] = | 
| &TestingAutomationProvider::GetFPS; | 
| +  browser_handler_map_["GetGpuMemoryUsage"] = | 
| +      &TestingAutomationProvider::GetGpuMemoryUsage; | 
|  | 
| browser_handler_map_["IsFullscreenForBrowser"] = | 
| &TestingAutomationProvider::IsFullscreenForBrowser; | 
| @@ -5101,6 +5105,51 @@ void TestingAutomationProvider::GetFPS( | 
| render_view->Send(new ChromeViewMsg_GetFPS(routing_id)); | 
| } | 
|  | 
| +class TestingAutomationGpuDataManagerObserver | 
| +    : public content::GpuDataManagerObserver { | 
| + public: | 
| +  TestingAutomationGpuDataManagerObserver( | 
| +      TestingAutomationProvider* provider, | 
| +      IPC::Message* reply_message) | 
| +      : provider_(provider), | 
| +        reply_message_(reply_message) { | 
| +    content::GpuDataManager::GetInstance()->AddObserver(this); | 
| +  } | 
| + | 
| +  virtual ~TestingAutomationGpuDataManagerObserver() { | 
| +    content::GpuDataManager::GetInstance()->RemoveObserver(this); | 
| +  } | 
| + | 
| +  virtual void OnGpuInfoUpdate() OVERRIDE {} | 
| + | 
| +  virtual void OnVideoMemoryUsageStatsUpdate( | 
| +      const content::GPUVideoMemoryUsageStats& video_memory_usage_stats) | 
| +          OVERRIDE { | 
| +    DictionaryValue dict; | 
| +    dict.SetInteger("gpu_memory_mbytes_allocated", static_cast<int>( | 
| +        video_memory_usage_stats.bytes_allocated/1048576)); | 
| +    AutomationJSONReply(provider_, reply_message_).SendSuccess(&dict); | 
| +    delete this; | 
| +  } | 
| + | 
| + private: | 
| +  TestingAutomationProvider* provider_; | 
| +  IPC::Message* reply_message_; | 
| +}; | 
| + | 
| +void TestingAutomationProvider::GetGpuMemoryUsage( | 
| +    Browser* browser, | 
| +    DictionaryValue* args, | 
| +    IPC::Message* reply_message) { | 
| +  if (!content::GpuDataManager::GetInstance()->GpuAccessAllowed()) { | 
| +    AutomationJSONReply(this, reply_message).SendError("Cannot access GPU"); | 
| +    return; | 
| +  } | 
| +  // This observer will delete itself. | 
| +  new TestingAutomationGpuDataManagerObserver(this, reply_message); | 
| +  content::GpuDataManager::GetInstance()->RequestVideoMemoryUsageStatsUpdate(); | 
| +} | 
| + | 
| void TestingAutomationProvider::IsFullscreenForBrowser(Browser* browser, | 
| base::DictionaryValue* args, | 
| IPC::Message* reply_message) { | 
|  |