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 <string> | 5 #include <string> |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 | 111 |
112 TEST(CommandExecutorImplTest, CommandThatReturnsError) { | 112 TEST(CommandExecutorImplTest, CommandThatReturnsError) { |
113 CommandExecutorImpl executor; | 113 CommandExecutorImpl executor; |
114 executor.command_map_.Set("simpleCommand", | 114 executor.command_map_.Set("simpleCommand", |
115 base::Bind(&ExecuteSimpleCommand3)); | 115 base::Bind(&ExecuteSimpleCommand3)); |
116 | 116 |
117 base::DictionaryValue params; | 117 base::DictionaryValue params; |
118 StatusCode status_code; | 118 StatusCode status_code; |
119 scoped_ptr<base::Value> value; | 119 scoped_ptr<base::Value> value; |
120 std::string out_session_id; | 120 std::string out_session_id; |
121 executor.ExecuteCommand("simpleCommand", params, "", | 121 executor.ExecuteCommand("simpleCommand", |
122 &status_code, &value, | 122 params, |
| 123 std::string(), |
| 124 &status_code, |
| 125 &value, |
123 &out_session_id); | 126 &out_session_id); |
124 ASSERT_EQ(kUnknownError, status_code); | 127 ASSERT_EQ(kUnknownError, status_code); |
125 ASSERT_TRUE(value); | 128 ASSERT_TRUE(value); |
126 base::DictionaryValue* error; | 129 base::DictionaryValue* error; |
127 ASSERT_TRUE(value->GetAsDictionary(&error)); | 130 ASSERT_TRUE(value->GetAsDictionary(&error)); |
128 std::string message; | 131 std::string message; |
129 ASSERT_TRUE(error->GetString("message", &message)); | 132 ASSERT_TRUE(error->GetString("message", &message)); |
130 ASSERT_NE(std::string::npos, message.find("unknown error")); | 133 ASSERT_NE(std::string::npos, message.find("unknown error")); |
131 } | 134 } |
OLD | NEW |