| 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/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 1821 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1832 *location = temp_location; | 1832 *location = temp_location; |
| 1833 return NULL; | 1833 return NULL; |
| 1834 } | 1834 } |
| 1835 | 1835 |
| 1836 Error* Session::GetScreenShot(std::string* png) { | 1836 Error* Session::GetScreenShot(std::string* png) { |
| 1837 if (!current_target_.view_id.IsTab()) { | 1837 if (!current_target_.view_id.IsTab()) { |
| 1838 return new Error(kUnknownError, | 1838 return new Error(kUnknownError, |
| 1839 "The current target does not support screenshot"); | 1839 "The current target does not support screenshot"); |
| 1840 } | 1840 } |
| 1841 Error* error = NULL; | 1841 Error* error = NULL; |
| 1842 ScopedTempDir screenshots_dir; | 1842 base::ScopedTempDir screenshots_dir; |
| 1843 if (!screenshots_dir.CreateUniqueTempDir()) { | 1843 if (!screenshots_dir.CreateUniqueTempDir()) { |
| 1844 return new Error(kUnknownError, | 1844 return new Error(kUnknownError, |
| 1845 "Could not create temp directory for screenshot"); | 1845 "Could not create temp directory for screenshot"); |
| 1846 } | 1846 } |
| 1847 | 1847 |
| 1848 FilePath path = screenshots_dir.path().AppendASCII("screen"); | 1848 FilePath path = screenshots_dir.path().AppendASCII("screen"); |
| 1849 RunSessionTask(base::Bind( | 1849 RunSessionTask(base::Bind( |
| 1850 &Automation::CaptureEntirePageAsPNG, | 1850 &Automation::CaptureEntirePageAsPNG, |
| 1851 base::Unretained(automation_.get()), | 1851 base::Unretained(automation_.get()), |
| 1852 current_target_.view_id, | 1852 current_target_.view_id, |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1952 capabilities_.local_state->GetWithoutPathExpansion(*iter, &value); | 1952 capabilities_.local_state->GetWithoutPathExpansion(*iter, &value); |
| 1953 Error* error = SetPreference(*iter, false /* is_user_pref */, | 1953 Error* error = SetPreference(*iter, false /* is_user_pref */, |
| 1954 value->DeepCopy()); | 1954 value->DeepCopy()); |
| 1955 if (error) | 1955 if (error) |
| 1956 return error; | 1956 return error; |
| 1957 } | 1957 } |
| 1958 return NULL; | 1958 return NULL; |
| 1959 } | 1959 } |
| 1960 | 1960 |
| 1961 } // namespace webdriver | 1961 } // namespace webdriver |
| OLD | NEW |