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

Unified Diff: chrome/test/chromedriver/chrome_impl_unittest.cc

Issue 12052004: [chromedriver] Create release script and handle Chrome/ChromeDriver versions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/test/chromedriver/chrome_impl.cc ('k') | chrome/test/chromedriver/commands.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/chromedriver/chrome_impl_unittest.cc
diff --git a/chrome/test/chromedriver/chrome_impl_unittest.cc b/chrome/test/chromedriver/chrome_impl_unittest.cc
index 8b52ad2c78e27d063bb1285d47887db5cfacba3b..3a23839d9cc283742c1e517fb567c0826819dddd 100644
--- a/chrome/test/chromedriver/chrome_impl_unittest.cc
+++ b/chrome/test/chromedriver/chrome_impl_unittest.cc
@@ -185,8 +185,7 @@ TEST(EvaluateScriptAndGetValue, Ok) {
base::DictionaryValue dict;
dict.SetBoolean("wasThrown", false);
dict.SetString("result.type", "integer");
- dict.SetInteger("result.value.status", 0);
- dict.SetInteger("result.value.value", 1);
+ dict.SetInteger("result.value", 1);
client.set_result(dict);
Status status = internal::EvaluateScriptAndGetValue(
&client, 0, "", &result);
@@ -196,21 +195,6 @@ TEST(EvaluateScriptAndGetValue, Ok) {
ASSERT_EQ(1, value);
}
-TEST(EvaluateScriptAndGetValue, ScriptError) {
- scoped_ptr<base::Value> result;
- FakeDevToolsClient client;
- base::DictionaryValue dict;
- dict.SetBoolean("wasThrown", false);
- dict.SetString("result.type", "integer");
- dict.SetInteger("result.value.status", 1);
- dict.SetInteger("result.value.value", 1);
- client.set_result(dict);
- Status status = internal::EvaluateScriptAndGetValue(
- &client, 0, "", &result);
- ASSERT_EQ(1, status.code());
- ASSERT_FALSE(result);
-}
-
TEST(EvaluateScriptAndGetObject, NoObject) {
FakeDevToolsClient client;
base::DictionaryValue dict;
@@ -234,3 +218,31 @@ TEST(EvaluateScriptAndGetObject, Ok) {
&client, 0, "", &object_id).IsOk());
ASSERT_STREQ("id", object_id.c_str());
}
+
+TEST(ParseCallFunctionResult, NotDict) {
+ scoped_ptr<base::Value> result;
+ base::FundamentalValue value(1);
+ ASSERT_NE(kOk, internal::ParseCallFunctionResult(value, &result).code());
+}
+
+TEST(ParseCallFunctionResult, Ok) {
+ scoped_ptr<base::Value> result;
+ base::DictionaryValue dict;
+ dict.SetInteger("status", 0);
+ dict.SetInteger("value", 1);
+ Status status = internal::ParseCallFunctionResult(dict, &result);
+ ASSERT_EQ(kOk, status.code());
+ int value;
+ ASSERT_TRUE(result && result->GetAsInteger(&value));
+ ASSERT_EQ(1, value);
+}
+
+TEST(ParseCallFunctionResult, ScriptError) {
+ scoped_ptr<base::Value> result;
+ base::DictionaryValue dict;
+ dict.SetInteger("status", 1);
+ dict.SetInteger("value", 1);
+ Status status = internal::ParseCallFunctionResult(dict, &result);
+ ASSERT_EQ(1, status.code());
+ ASSERT_FALSE(result);
+}
« no previous file with comments | « chrome/test/chromedriver/chrome_impl.cc ('k') | chrome/test/chromedriver/commands.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698