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 <list> | 7 #include <list> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
732 const base::DictionaryValue& params, | 732 const base::DictionaryValue& params, |
733 scoped_ptr<base::Value>* value) { | 733 scoped_ptr<base::Value>* value) { |
734 Status status = session->chrome->ActivateWebView(web_view->GetId()); | 734 Status status = session->chrome->ActivateWebView(web_view->GetId()); |
735 if (status.IsError()) | 735 if (status.IsError()) |
736 return status; | 736 return status; |
737 | 737 |
738 std::string screenshot; | 738 std::string screenshot; |
739 if (session->chrome->GetType() == Chrome::DESKTOP && | 739 if (session->chrome->GetType() == Chrome::DESKTOP && |
740 !session->force_devtools_screenshot) { | 740 !session->force_devtools_screenshot) { |
741 AutomationExtension* extension = NULL; | 741 AutomationExtension* extension = NULL; |
742 Status status = session->chrome->GetAutomationExtension(&extension); | 742 status = session->chrome->GetAutomationExtension(&extension); |
743 if (status.IsError()) | 743 if (status.IsError()) |
744 return status; | 744 return status; |
745 status = extension->CaptureScreenshot(&screenshot); | 745 status = extension->CaptureScreenshot(&screenshot); |
746 // If the screenshot was forbidden, fallback to DevTools. | 746 // If the screenshot was forbidden, fallback to DevTools. |
747 if (status.code() != kForbidden) | 747 if (status.code() == kForbidden) |
748 return status; | 748 status = web_view->CaptureScreenshot(&screenshot); |
| 749 } else { |
| 750 status = web_view->CaptureScreenshot(&screenshot); |
749 } | 751 } |
750 | |
751 status = web_view->CaptureScreenshot(&screenshot); | |
752 if (status.IsError()) | 752 if (status.IsError()) |
753 return status; | 753 return status; |
754 | 754 |
755 value->reset(new base::StringValue(screenshot)); | 755 value->reset(new base::StringValue(screenshot)); |
756 return Status(kOk); | 756 return Status(kOk); |
757 } | 757 } |
758 | 758 |
759 Status ExecuteGetCookies( | 759 Status ExecuteGetCookies( |
760 Session* session, | 760 Session* session, |
761 WebView* web_view, | 761 WebView* web_view, |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
852 // |accuracy| is not part of the WebDriver spec yet, so if it is not given | 852 // |accuracy| is not part of the WebDriver spec yet, so if it is not given |
853 // default to 100 meters accuracy. | 853 // default to 100 meters accuracy. |
854 geoposition.accuracy = 100; | 854 geoposition.accuracy = 100; |
855 } | 855 } |
856 | 856 |
857 Status status = web_view->OverrideGeolocation(geoposition); | 857 Status status = web_view->OverrideGeolocation(geoposition); |
858 if (status.IsOk()) | 858 if (status.IsOk()) |
859 session->overridden_geoposition.reset(new Geoposition(geoposition)); | 859 session->overridden_geoposition.reset(new Geoposition(geoposition)); |
860 return status; | 860 return status; |
861 } | 861 } |
OLD | NEW |