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/webdriver/commands/webelement_commands.h" | 5 #include "chrome/test/webdriver/commands/webelement_commands.h" |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/format_macros.h" | 8 #include "base/format_macros.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/strings/string_split.h" | 10 #include "base/strings/string_split.h" |
(...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
554 bool multiple = false; | 554 bool multiple = false; |
555 Error* error = HasAttributeWithLowerCaseValueASCII("multiple", "true", | 555 Error* error = HasAttributeWithLowerCaseValueASCII("multiple", "true", |
556 &multiple); | 556 &multiple); |
557 if (error) | 557 if (error) |
558 return error; | 558 return error; |
559 if (!multiple && paths.size() > 1) | 559 if (!multiple && paths.size() > 1) |
560 return new Error(kBadRequest, "The element can not hold multiple files"); | 560 return new Error(kBadRequest, "The element can not hold multiple files"); |
561 | 561 |
562 // Check the files exist. | 562 // Check the files exist. |
563 for (size_t i = 0; i < paths.size(); ++i) { | 563 for (size_t i = 0; i < paths.size(); ++i) { |
564 if (!file_util::PathExists(base::FilePath(paths[i]))) { | 564 if (!base::PathExists(base::FilePath(paths[i]))) { |
565 return new Error( | 565 return new Error( |
566 kBadRequest, | 566 kBadRequest, |
567 base::StringPrintf("'%s' does not exist on the file system", | 567 base::StringPrintf("'%s' does not exist on the file system", |
568 UTF16ToUTF8( | 568 UTF16ToUTF8( |
569 base::FilePath(paths[i]).LossyDisplayName()).c_str())); | 569 base::FilePath(paths[i]).LossyDisplayName()).c_str())); |
570 } | 570 } |
571 } | 571 } |
572 | 572 |
573 Point location; | 573 Point location; |
574 error = session_->GetClickableLocation(element, &location); | 574 error = session_->GetClickableLocation(element, &location); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
623 return; | 623 return; |
624 } | 624 } |
625 if (!result->IsType(base::Value::TYPE_STRING)) { | 625 if (!result->IsType(base::Value::TYPE_STRING)) { |
626 response->SetError(new Error(kUnknownError, "Result is not string type")); | 626 response->SetError(new Error(kUnknownError, "Result is not string type")); |
627 return; | 627 return; |
628 } | 628 } |
629 response->SetValue(result.release()); | 629 response->SetValue(result.release()); |
630 } | 630 } |
631 | 631 |
632 } // namespace webdriver | 632 } // namespace webdriver |
OLD | NEW |