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

Side by Side Diff: chrome/test/webdriver/webdriver_session.cc

Issue 9288051: Implement the webdriver window sizing commands. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ... Created 8 years, 10 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/webdriver/webdriver_session.h ('k') | chrome/test/webdriver/webdriver_util.h » ('j') | 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) 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 752 matching lines...) Expand 10 before | Expand all | Expand 10 after
763 // session. 763 // session.
764 // TODO(kkania): This will cause us problems if GetWindowIds fails for a 764 // TODO(kkania): This will cause us problems if GetWindowIds fails for a
765 // reason other than the channel is disconnected. Look into having 765 // reason other than the channel is disconnected. Look into having
766 // |GetWindowIds| tell us if it just closed the last window. 766 // |GetWindowIds| tell us if it just closed the last window.
767 Terminate(); 767 Terminate();
768 } 768 }
769 } 769 }
770 return error; 770 return error;
771 } 771 }
772 772
773 Error* Session::GetWindowBounds(const WebViewId& window, Rect* bounds) {
774 const char* kGetWindowBoundsScript =
775 "function() {"
776 " return {"
777 " 'left': window.screenX,"
778 " 'top': window.screenY,"
779 " 'width': window.outerWidth,"
780 " 'height': window.outerHeight"
781 " }"
782 "}";
783 return ExecuteScriptAndParse(
784 FrameId(window, FramePath()),
785 kGetWindowBoundsScript,
786 "getWindowBoundsScript",
787 new ListValue(),
788 CreateDirectValueParser(bounds));
789 }
790
791 Error* Session::SetWindowBounds(
792 const WebViewId& window,
793 const Rect& bounds) {
794 Error* error = NULL;
795 RunSessionTask(base::Bind(
796 &Automation::SetViewBounds,
797 base::Unretained(automation_.get()),
798 window,
799 bounds,
800 &error));
801 return error;
802 }
803
773 Error* Session::GetAlertMessage(std::string* text) { 804 Error* Session::GetAlertMessage(std::string* text) {
774 Error* error = NULL; 805 Error* error = NULL;
775 RunSessionTask(base::Bind( 806 RunSessionTask(base::Bind(
776 &Automation::GetAppModalDialogMessage, 807 &Automation::GetAppModalDialogMessage,
777 base::Unretained(automation_.get()), 808 base::Unretained(automation_.get()),
778 text, 809 text,
779 &error)); 810 &error));
780 return error; 811 return error;
781 } 812 }
782 813
(...skipping 1040 matching lines...) Expand 10 before | Expand all | Expand 10 after
1823 DictionaryValue* default_content_settings = new DictionaryValue(); 1854 DictionaryValue* default_content_settings = new DictionaryValue();
1824 default_content_settings->SetInteger("geolocation", kAllowContent); 1855 default_content_settings->SetInteger("geolocation", kAllowContent);
1825 default_content_settings->SetInteger("notifications", kAllowContent); 1856 default_content_settings->SetInteger("notifications", kAllowContent);
1826 return SetPreference( 1857 return SetPreference(
1827 "profile.default_content_settings", 1858 "profile.default_content_settings",
1828 true /* is_user_pref */, 1859 true /* is_user_pref */,
1829 default_content_settings); 1860 default_content_settings);
1830 } 1861 }
1831 1862
1832 } // namespace webdriver 1863 } // namespace webdriver
OLDNEW
« no previous file with comments | « chrome/test/webdriver/webdriver_session.h ('k') | chrome/test/webdriver/webdriver_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698