| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/chromedriver/window_commands.h" | 5 #include "chrome/test/chromedriver/window_commands.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <list> | 9 #include <list> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 834 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 845 | 845 |
| 846 std::string screenshot; | 846 std::string screenshot; |
| 847 ChromeDesktopImpl* desktop = NULL; | 847 ChromeDesktopImpl* desktop = NULL; |
| 848 status = session->chrome->GetAsDesktop(&desktop); | 848 status = session->chrome->GetAsDesktop(&desktop); |
| 849 if (status.IsOk() && !session->force_devtools_screenshot) { | 849 if (status.IsOk() && !session->force_devtools_screenshot) { |
| 850 AutomationExtension* extension = NULL; | 850 AutomationExtension* extension = NULL; |
| 851 status = desktop->GetAutomationExtension(&extension); | 851 status = desktop->GetAutomationExtension(&extension); |
| 852 if (status.IsError()) | 852 if (status.IsError()) |
| 853 return status; | 853 return status; |
| 854 status = extension->CaptureScreenshot(&screenshot); | 854 status = extension->CaptureScreenshot(&screenshot); |
| 855 if (status.IsError()) { | |
| 856 LOG(WARNING) << "screenshot failed with extension, fallback to DevTools"; | |
| 857 status = web_view->CaptureScreenshot(&screenshot); | |
| 858 } | |
| 859 } else { | 855 } else { |
| 860 status = web_view->CaptureScreenshot(&screenshot); | 856 status = web_view->CaptureScreenshot(&screenshot); |
| 861 } | 857 } |
| 858 if (status.IsError()) { |
| 859 LOG(WARNING) << "screenshot failed, retrying"; |
| 860 status = web_view->CaptureScreenshot(&screenshot); |
| 861 } |
| 862 if (status.IsError()) | 862 if (status.IsError()) |
| 863 return status; | 863 return status; |
| 864 | 864 |
| 865 value->reset(new base::StringValue(screenshot)); | 865 value->reset(new base::StringValue(screenshot)); |
| 866 return Status(kOk); | 866 return Status(kOk); |
| 867 } | 867 } |
| 868 | 868 |
| 869 Status ExecuteGetCookies( | 869 Status ExecuteGetCookies( |
| 870 Session* session, | 870 Session* session, |
| 871 WebView* web_view, | 871 WebView* web_view, |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1053 return status; | 1053 return status; |
| 1054 } | 1054 } |
| 1055 | 1055 |
| 1056 Status ExecuteTakeHeapSnapshot( | 1056 Status ExecuteTakeHeapSnapshot( |
| 1057 Session* session, | 1057 Session* session, |
| 1058 WebView* web_view, | 1058 WebView* web_view, |
| 1059 const base::DictionaryValue& params, | 1059 const base::DictionaryValue& params, |
| 1060 scoped_ptr<base::Value>* value) { | 1060 scoped_ptr<base::Value>* value) { |
| 1061 return web_view->TakeHeapSnapshot(value); | 1061 return web_view->TakeHeapSnapshot(value); |
| 1062 } | 1062 } |
| OLD | NEW |