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

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 (status.code() != kForbidden)
chrisgao (Use stgao instead) 2013/09/09 22:56:04 How about adding a comment for the special case?
kkania 2013/09/11 18:24:21 Done.
747 return status;
748 } else {
749 Status status = web_view->CaptureScreenshot(&screenshot);
750 if (status.IsError())
751 return status; 747 return status;
752 } 748 }
749
750 status = web_view->CaptureScreenshot(&screenshot);
751 if (status.IsError())
752 return status;
753
753 value->reset(new base::StringValue(screenshot)); 754 value->reset(new base::StringValue(screenshot));
754 return Status(kOk); 755 return Status(kOk);
755 } 756 }
756 757
757 Status ExecuteGetCookies( 758 Status ExecuteGetCookies(
758 Session* session, 759 Session* session,
759 WebView* web_view, 760 WebView* web_view,
760 const base::DictionaryValue& params, 761 const base::DictionaryValue& params,
761 scoped_ptr<base::Value>* value) { 762 scoped_ptr<base::Value>* value) {
762 std::list<Cookie> cookies; 763 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 851 // |accuracy| is not part of the WebDriver spec yet, so if it is not given
851 // default to 100 meters accuracy. 852 // default to 100 meters accuracy.
852 geoposition.accuracy = 100; 853 geoposition.accuracy = 100;
853 } 854 }
854 855
855 Status status = web_view->OverrideGeolocation(geoposition); 856 Status status = web_view->OverrideGeolocation(geoposition);
856 if (status.IsOk()) 857 if (status.IsOk())
857 session->overridden_geoposition.reset(new Geoposition(geoposition)); 858 session->overridden_geoposition.reset(new Geoposition(geoposition));
858 return status; 859 return status;
859 } 860 }
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