OLD | NEW |
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 <string> | 5 #include <string> |
6 #include <vector> | 6 #include <vector> |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 #include "chrome/test/webdriver/commands/response.h" | 10 #include "chrome/test/webdriver/commands/response.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 } | 24 } |
25 | 25 |
26 void AssertError(ErrorCode expected_status, | 26 void AssertError(ErrorCode expected_status, |
27 const std::string& expected_message, | 27 const std::string& expected_message, |
28 ImplicitWaitCommand* const command) { | 28 ImplicitWaitCommand* const command) { |
29 Response response; | 29 Response response; |
30 command->ExecutePost(&response); | 30 command->ExecutePost(&response); |
31 ASSERT_EQ(expected_status, response.GetStatus()) << response.ToJSON(); | 31 ASSERT_EQ(expected_status, response.GetStatus()) << response.ToJSON(); |
32 | 32 |
33 const Value* value = response.GetValue(); | 33 const Value* value = response.GetValue(); |
34 ASSERT_TRUE(value->IsType(Value::TYPE_DICTIONARY)); | 34 ASSERT_TRUE(value->IsDictionary()); |
35 | 35 |
36 const DictionaryValue* dict = static_cast<const DictionaryValue*>(value); | 36 const DictionaryValue* dict = static_cast<const DictionaryValue*>(value); |
37 std::string actual_message; | 37 std::string actual_message; |
38 ASSERT_TRUE(dict->GetString("message", &actual_message)); | 38 ASSERT_TRUE(dict->GetString("message", &actual_message)); |
39 ASSERT_EQ(expected_message, actual_message); | 39 ASSERT_EQ(expected_message, actual_message); |
40 } | 40 } |
41 | 41 |
42 void AssertTimeoutSet(const Session& test_session, int expected_timeout, | 42 void AssertTimeoutSet(const Session& test_session, int expected_timeout, |
43 ImplicitWaitCommand* const command) { | 43 ImplicitWaitCommand* const command) { |
44 Response response; | 44 Response response; |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 | 82 |
83 parameters->SetInteger("ms", 1); | 83 parameters->SetInteger("ms", 1); |
84 AssertTimeoutSet(test_session, 1, &command); | 84 AssertTimeoutSet(test_session, 1, &command); |
85 parameters->SetDouble("ms", 2.5); | 85 parameters->SetDouble("ms", 2.5); |
86 AssertTimeoutSet(test_session, 2, &command); | 86 AssertTimeoutSet(test_session, 2, &command); |
87 parameters->SetInteger("ms", 0); | 87 parameters->SetInteger("ms", 0); |
88 AssertTimeoutSet(test_session, 0, &command); | 88 AssertTimeoutSet(test_session, 0, &command); |
89 } | 89 } |
90 | 90 |
91 } // namespace webdriver | 91 } // namespace webdriver |
OLD | NEW |