summaryrefslogtreecommitdiffstats
path: root/chrome/test
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/test')
-rw-r--r--chrome/test/automation/automation_json_requests.cc8
-rw-r--r--chrome/test/automation/javascript_execution_controller.cc6
-rw-r--r--chrome/test/automation/javascript_message_utils.h6
-rw-r--r--chrome/test/automation/tab_proxy.cc12
-rw-r--r--chrome/test/automation/value_conversion_traits.cc7
-rw-r--r--chrome/test/base/ui_test_utils.cc8
-rw-r--r--chrome/test/perf/dom_checker_uitest.cc7
-rw-r--r--chrome/test/webdriver/commands/response.cc2
-rw-r--r--chrome/test/webdriver/commands/response.h2
-rw-r--r--chrome/test/webdriver/webdriver_dispatch.cc9
-rw-r--r--chrome/test/webdriver/webdriver_session.cc4
11 files changed, 36 insertions, 35 deletions
diff --git a/chrome/test/automation/automation_json_requests.cc b/chrome/test/automation/automation_json_requests.cc
index ecd932e..ab0de31 100644
--- a/chrome/test/automation/automation_json_requests.cc
+++ b/chrome/test/automation/automation_json_requests.cc
@@ -187,11 +187,11 @@ bool SendExecuteJavascriptJSONRequest(
JSONStringValueSerializer deserializer(json);
Value* value = deserializer.Deserialize(NULL, NULL);
- if (!value || !value->AsList()) {
+ if (!value || !value->IsType(Value::TYPE_LIST)) {
LOG(ERROR) << "Unable to deserialize returned JSON";
return false;
}
- scoped_ptr<ListValue> list(value->AsList());
+ scoped_ptr<ListValue> list(static_cast<ListValue*>(value));
return list->Remove(0, result);
}
@@ -297,9 +297,9 @@ bool SendGetCookiesJSONRequest(
if (!reply_dict.Remove("cookies", &cookies_unscoped_value))
return false;
scoped_ptr<Value> cookies_value(cookies_unscoped_value);
- if (!cookies_value->AsList())
+ if (!cookies_value->IsType(Value::TYPE_LIST))
return false;
- *cookies = cookies_value->AsList();
+ *cookies = static_cast<ListValue*>(cookies_value.release());
return true;
}
diff --git a/chrome/test/automation/javascript_execution_controller.cc b/chrome/test/automation/javascript_execution_controller.cc
index e4702c5..5be6b98 100644
--- a/chrome/test/automation/javascript_execution_controller.cc
+++ b/chrome/test/automation/javascript_execution_controller.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -89,11 +89,11 @@ bool JavaScriptExecutionController::ExecuteAndParseHelper(
bool success;
std::string evaluation_error;
Value* evaluation_result_value;
- ListValue* list = root_value->AsList();
- if (!list) {
+ if (!root_value->IsType(Value::TYPE_LIST)) {
LOG(ERROR) << "JSON response was not in correct format";
return false;
}
+ ListValue* list = static_cast<ListValue*>(root_value.get());
if (!list->GetBoolean(0, &success) ||
!list->GetString(1, &evaluation_error) ||
!list->Remove(2, &evaluation_result_value)) {
diff --git a/chrome/test/automation/javascript_message_utils.h b/chrome/test/automation/javascript_message_utils.h
index 1ccdc17..e4b61f4 100644
--- a/chrome/test/automation/javascript_message_utils.h
+++ b/chrome/test/automation/javascript_message_utils.h
@@ -51,11 +51,11 @@ struct ValueConversionTraits<std::vector<T> > {
}
return value;
}
- static bool SetFromValue(Value* value, std::vector<T>* t) {
- ListValue* list_value = value->AsList();
- if (!list_value)
+ static bool SetFromValue(const Value* value, std::vector<T>* t) {
+ if (!value->IsType(Value::TYPE_LIST))
return false;
+ const ListValue* list_value = static_cast<const ListValue*>(value);
ListValue::const_iterator iter;
for (iter = list_value->begin(); iter != list_value->end(); ++iter) {
if (!ValueConversionTraits<T>::CanConvert(*iter))
diff --git a/chrome/test/automation/tab_proxy.cc b/chrome/test/automation/tab_proxy.cc
index d30fd7d..49cd00c 100644
--- a/chrome/test/automation/tab_proxy.cc
+++ b/chrome/test/automation/tab_proxy.cc
@@ -266,9 +266,9 @@ bool TabProxy::ExecuteAndExtractString(const std::wstring& frame_xpath,
if (!succeeded)
return false;
- DCHECK(root->AsList());
+ DCHECK(root->IsType(Value::TYPE_LIST));
Value* value = NULL;
- succeeded = root->AsList()->Get(0, &value);
+ succeeded = static_cast<ListValue*>(root)->Get(0, &value);
if (succeeded) {
string16 read_value;
succeeded = value->GetAsString(&read_value);
@@ -291,9 +291,9 @@ bool TabProxy::ExecuteAndExtractBool(const std::wstring& frame_xpath,
return false;
bool read_value = false;
- DCHECK(root->AsList());
+ DCHECK(root->IsType(Value::TYPE_LIST));
Value* value = NULL;
- succeeded = root->AsList()->Get(0, &value);
+ succeeded = static_cast<ListValue*>(root)->Get(0, &value);
if (succeeded) {
succeeded = value->GetAsBoolean(&read_value);
if (succeeded) {
@@ -314,9 +314,9 @@ bool TabProxy::ExecuteAndExtractInt(const std::wstring& frame_xpath,
return false;
int read_value = 0;
- DCHECK(root->AsList());
+ DCHECK(root->IsType(Value::TYPE_LIST));
Value* value = NULL;
- succeeded = root->AsList()->Get(0, &value);
+ succeeded = static_cast<ListValue*>(root)->Get(0, &value);
if (succeeded) {
succeeded = value->GetAsInteger(&read_value);
if (succeeded) {
diff --git a/chrome/test/automation/value_conversion_traits.cc b/chrome/test/automation/value_conversion_traits.cc
index 16d6510..f5c1f2c 100644
--- a/chrome/test/automation/value_conversion_traits.cc
+++ b/chrome/test/automation/value_conversion_traits.cc
@@ -71,15 +71,14 @@ Value* ValueConversionTraits<ListValue*>::CreateValueFrom(const ListValue* t) {
bool ValueConversionTraits<ListValue*>::SetFromValue(const Value* value,
ListValue** t) {
- ListValue* list = const_cast<Value*>(value)->AsList();
- if (!list)
+ if (!value->IsType(Value::TYPE_LIST))
return false;
- *t = list->DeepCopy();
+ *t = static_cast<const ListValue*>(value)->DeepCopy();
return true;
}
bool ValueConversionTraits<ListValue*>::CanConvert(const Value* value) {
- return const_cast<Value*>(value)->AsList();
+ return value->IsType(Value::TYPE_LIST);
}
Value* ValueConversionTraits<DictionaryValue*>::CreateValueFrom(
diff --git a/chrome/test/base/ui_test_utils.cc b/chrome/test/base/ui_test_utils.cc
index 2234ba2..d087e68 100644
--- a/chrome/test/base/ui_test_utils.cc
+++ b/chrome/test/base/ui_test_utils.cc
@@ -206,10 +206,10 @@ bool ExecuteJavaScriptHelper(RenderViewHost* render_view_host,
json.append("]");
scoped_ptr<Value> root_val(base::JSONReader::Read(json, true));
- ListValue* list = root_val->AsList();
- if (!list)
+ if (!root_val->IsType(Value::TYPE_LIST))
return false;
+ ListValue* list = static_cast<ListValue*>(root_val.get());
Value* result_val;
if (!list || !list->GetSize() ||
!list->Remove(0, &result_val)) // Remove gives us ownership of the value.
@@ -925,9 +925,9 @@ class SnapshotTaker {
// Parse the JSON.
std::vector<int> dimensions;
scoped_ptr<Value> value(base::JSONReader::Read(json, true));
- ListValue* list = value->AsList();
- if (!list)
+ if (!value->IsType(Value::TYPE_LIST))
return false;
+ ListValue* list = static_cast<ListValue*>(value.get());
int width, height;
if (!list->GetInteger(0, &width) || !list->GetInteger(1, &height))
return false;
diff --git a/chrome/test/perf/dom_checker_uitest.cc b/chrome/test/perf/dom_checker_uitest.cc
index deceb9e..8255a94 100644
--- a/chrome/test/perf/dom_checker_uitest.cc
+++ b/chrome/test/perf/dom_checker_uitest.cc
@@ -175,11 +175,12 @@ class DomCheckerTest : public UITest {
if (!value.get())
return false;
- EXPECT_TRUE(value->AsList());
- ListValue* list_value = value->AsList();
- if (!list_value)
+ EXPECT_TRUE(value->IsType(Value::TYPE_LIST));
+ if (!value->IsType(Value::TYPE_LIST))
return false;
+ ListValue* list_value = static_cast<ListValue*>(value.get());
+
// The parsed JSON object will be an array of strings, each of which is a
// test failure. Add those strings to the results set.
ListValue::const_iterator it = list_value->begin();
diff --git a/chrome/test/webdriver/commands/response.cc b/chrome/test/webdriver/commands/response.cc
index 882dbeb..1c09d39 100644
--- a/chrome/test/webdriver/commands/response.cc
+++ b/chrome/test/webdriver/commands/response.cc
@@ -46,7 +46,7 @@ void Response::SetStatus(ErrorCode status) {
data_.SetInteger(kStatusKey, status);
}
-Value* Response::GetValue() const {
+const Value* Response::GetValue() const {
Value* out = NULL;
LOG_IF(WARNING, !data_.Get(kValueKey, &out))
<< "Accessing unset response value."; // Should never happen.
diff --git a/chrome/test/webdriver/commands/response.h b/chrome/test/webdriver/commands/response.h
index 0d25c48..9c44e60 100644
--- a/chrome/test/webdriver/commands/response.h
+++ b/chrome/test/webdriver/commands/response.h
@@ -28,7 +28,7 @@ class Response {
void SetStatus(ErrorCode status);
// Ownership of the returned pointer is kept by this object.
- Value* GetValue() const;
+ const Value* GetValue() const;
// Sets the |value| of this response, assuming ownership of the object in the
// process.
diff --git a/chrome/test/webdriver/webdriver_dispatch.cc b/chrome/test/webdriver/webdriver_dispatch.cc
index e079f12..a9dcd4a 100644
--- a/chrome/test/webdriver/webdriver_dispatch.cc
+++ b/chrome/test/webdriver/webdriver_dispatch.cc
@@ -152,7 +152,7 @@ void PrepareHttpResponse(const Response& command_response,
// and kMethodNotAllowed should be detected before creating
// a command_response, and should thus not need conversion.
case kSeeOther: {
- Value* value = command_response.GetValue();
+ const Value* const value = command_response.GetValue();
std::string location;
if (!value->GetAsString(&location)) {
// This should never happen.
@@ -173,9 +173,8 @@ void PrepareHttpResponse(const Response& command_response,
break;
case kMethodNotAllowed: {
- Value* value = command_response.GetValue();
- ListValue* list_value = value->AsList();
- if (!list_value) {
+ const Value* const value = command_response.GetValue();
+ if (!value->IsType(Value::TYPE_LIST)) {
// This should never happen.
http_response->set_status(HttpResponse::kInternalServerError);
http_response->SetBody(
@@ -184,6 +183,8 @@ void PrepareHttpResponse(const Response& command_response,
return;
}
+ const ListValue* const list_value =
+ static_cast<const ListValue* const>(value);
std::vector<std::string> allowed_methods;
for (size_t i = 0; i < list_value->GetSize(); ++i) {
std::string method;
diff --git a/chrome/test/webdriver/webdriver_session.cc b/chrome/test/webdriver/webdriver_session.cc
index c3a7c11..1a764a8 100644
--- a/chrome/test/webdriver/webdriver_session.cc
+++ b/chrome/test/webdriver/webdriver_session.cc
@@ -1240,9 +1240,9 @@ Error* Session::ExecuteFindElementScriptAndParse(
virtual ~FindElementsParser() { }
virtual bool Parse(base::Value* value) const OVERRIDE {
- ListValue* list = value->AsList();
- if (!list)
+ if (!value->IsType(Value::TYPE_LIST))
return false;
+ ListValue* list = static_cast<ListValue*>(value);
for (size_t i = 0; i < list->GetSize(); ++i) {
ElementId element;
Value* element_value = NULL;