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

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

Issue 7661009: base: Add Is* functions to Value class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: tony review Created 9 years, 4 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_element_id.h" 5 #include "chrome/test/webdriver/webdriver_element_id.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/values.h" 8 #include "base/values.h"
9 #include "chrome/test/automation/javascript_message_utils.h" 9 #include "chrome/test/automation/javascript_message_utils.h"
10 10
(...skipping 15 matching lines...) Expand all
26 const char LocatorType::kPartialLinkText[] = "partialLinkText"; 26 const char LocatorType::kPartialLinkText[] = "partialLinkText";
27 const char LocatorType::kTagName[] = "tagName"; 27 const char LocatorType::kTagName[] = "tagName";
28 const char LocatorType::kXpath[] = "xpath"; 28 const char LocatorType::kXpath[] = "xpath";
29 29
30 ElementId::ElementId() : is_valid_(false) {} 30 ElementId::ElementId() : is_valid_(false) {}
31 31
32 ElementId::ElementId(const std::string& id) : id_(id), is_valid_(true) {} 32 ElementId::ElementId(const std::string& id) : id_(id), is_valid_(true) {}
33 33
34 ElementId::ElementId(const Value* value) { 34 ElementId::ElementId(const Value* value) {
35 is_valid_ = false; 35 is_valid_ = false;
36 if (value->IsType(Value::TYPE_DICTIONARY)) { 36 if (value->IsDictionary()) {
37 is_valid_ = static_cast<const DictionaryValue*>(value)-> 37 is_valid_ = static_cast<const DictionaryValue*>(value)->
38 GetString(kWebElementKey, &id_); 38 GetString(kWebElementKey, &id_);
39 } 39 }
40 } 40 }
41 41
42 ElementId::~ElementId() {} 42 ElementId::~ElementId() {}
43 43
44 Value* ElementId::ToValue() const { 44 Value* ElementId::ToValue() const {
45 CHECK(is_valid_); 45 CHECK(is_valid_);
46 if (id_.empty()) 46 if (id_.empty())
(...skipping 20 matching lines...) Expand all
67 if (id.is_valid()) 67 if (id.is_valid())
68 *t = id; 68 *t = id;
69 return id.is_valid(); 69 return id.is_valid();
70 } 70 }
71 71
72 bool ValueConversionTraits<webdriver::ElementId>::CanConvert( 72 bool ValueConversionTraits<webdriver::ElementId>::CanConvert(
73 const base::Value* value) { 73 const base::Value* value) {
74 webdriver::ElementId t; 74 webdriver::ElementId t;
75 return SetFromValue(value, &t); 75 return SetFromValue(value, &t);
76 } 76 }
OLDNEW
« no previous file with comments | « chrome/test/webdriver/webdriver_dispatch_unittest.cc ('k') | chrome/test/webdriver/webdriver_session.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698