Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(45)

Side by Side Diff: chrome/test/chromedriver/window_commands.cc

Issue 23542015: [chromedriver] Fallback to devtools for screenshotting of forbidden urls. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/test/chromedriver/extension/background.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 725 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 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 (status.IsError()) 746 // If the screenshot was forbidden, fallback to DevTools.
747 return status; 747 if (status.code() != kForbidden)
748 } else {
749 Status status = web_view->CaptureScreenshot(&screenshot);
750 if (status.IsError())
751 return status; 748 return status;
752 } 749 }
750
751 status = web_view->CaptureScreenshot(&screenshot);
752 if (status.IsError())
753 return status;
754
753 value->reset(new base::StringValue(screenshot)); 755 value->reset(new base::StringValue(screenshot));
754 return Status(kOk); 756 return Status(kOk);
755 } 757 }
756 758
757 Status ExecuteGetCookies( 759 Status ExecuteGetCookies(
758 Session* session, 760 Session* session,
759 WebView* web_view, 761 WebView* web_view,
760 const base::DictionaryValue& params, 762 const base::DictionaryValue& params,
761 scoped_ptr<base::Value>* value) { 763 scoped_ptr<base::Value>* value) {
762 std::list<Cookie> cookies; 764 std::list<Cookie> cookies;
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
850 // |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
851 // default to 100 meters accuracy. 853 // default to 100 meters accuracy.
852 geoposition.accuracy = 100; 854 geoposition.accuracy = 100;
853 } 855 }
854 856
855 Status status = web_view->OverrideGeolocation(geoposition); 857 Status status = web_view->OverrideGeolocation(geoposition);
856 if (status.IsOk()) 858 if (status.IsOk())
857 session->overridden_geoposition.reset(new Geoposition(geoposition)); 859 session->overridden_geoposition.reset(new Geoposition(geoposition));
858 return status; 860 return status;
859 } 861 }
OLDNEW
« no previous file with comments | « chrome/test/chromedriver/extension/background.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698