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/chromedriver/commands.h" | 5 #include "chrome/test/chromedriver/commands.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/format_macros.h" | 10 #include "base/format_macros.h" |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 base::ListValue args; | 141 base::ListValue args; |
142 args.Append(new base::StringValue(xpath)); | 142 args.Append(new base::StringValue(xpath)); |
143 std::string frame; | 143 std::string frame; |
144 Status status = session->chrome->GetFrameByFunction( | 144 Status status = session->chrome->GetFrameByFunction( |
145 session->frame, evaluate_xpath_script, args, &frame); | 145 session->frame, evaluate_xpath_script, args, &frame); |
146 if (status.IsError()) | 146 if (status.IsError()) |
147 return status; | 147 return status; |
148 session->frame = frame; | 148 session->frame = frame; |
149 return Status(kOk); | 149 return Status(kOk); |
150 } | 150 } |
| 151 |
| 152 Status ExecuteGetTitle( |
| 153 Session* session, |
| 154 const base::DictionaryValue& params, |
| 155 scoped_ptr<base::Value>* value) { |
| 156 const char* kGetTitleScript = |
| 157 "function() {" |
| 158 " if (document.title)" |
| 159 " return document.title;" |
| 160 " else" |
| 161 " return document.URL;" |
| 162 "}"; |
| 163 base::ListValue args; |
| 164 return session->chrome->CallFunction( |
| 165 session->frame, kGetTitleScript, args, value); |
| 166 } |
OLD | NEW |