| 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/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 const std::string& function, | 49 const std::string& function, |
| 50 const base::ListValue& args, | 50 const base::ListValue& args, |
| 51 std::string* out_frame) OVERRIDE { | 51 std::string* out_frame) OVERRIDE { |
| 52 return Status(kOk); | 52 return Status(kOk); |
| 53 } | 53 } |
| 54 virtual Status Quit() OVERRIDE { | 54 virtual Status Quit() OVERRIDE { |
| 55 return Status(kOk); | 55 return Status(kOk); |
| 56 } | 56 } |
| 57 }; | 57 }; |
| 58 | 58 |
| 59 class OkChrome : public StubChrome { |
| 60 public: |
| 61 OkChrome() {} |
| 62 virtual ~OkChrome() {} |
| 63 |
| 64 // Overridden from StubChrome: |
| 65 virtual Status EvaluateScript(const std::string& frame, |
| 66 const std::string& function, |
| 67 scoped_ptr<base::Value>* result) OVERRIDE { |
| 68 result->reset(base::Value::CreateStringValue("99.0.99999.0")); |
| 69 return Status(kOk); |
| 70 } |
| 71 }; |
| 72 |
| 59 class OkLauncher : public ChromeLauncher { | 73 class OkLauncher : public ChromeLauncher { |
| 60 public: | 74 public: |
| 61 OkLauncher() {} | 75 OkLauncher() {} |
| 62 virtual ~OkLauncher() {} | 76 virtual ~OkLauncher() {} |
| 63 | 77 |
| 64 // Overridden from ChromeLauncher: | 78 // Overridden from ChromeLauncher: |
| 65 virtual Status Launch(const FilePath& chrome_exe, | 79 virtual Status Launch(const FilePath& chrome_exe, |
| 66 scoped_ptr<Chrome>* chrome) OVERRIDE { | 80 scoped_ptr<Chrome>* chrome) OVERRIDE { |
| 67 chrome->reset(new StubChrome()); | 81 chrome->reset(new OkChrome()); |
| 68 return Status(kOk); | 82 return Status(kOk); |
| 69 } | 83 } |
| 70 }; | 84 }; |
| 71 | 85 |
| 72 } // namespace | 86 } // namespace |
| 73 | 87 |
| 74 TEST(CommandsTest, NewSession) { | 88 TEST(CommandsTest, NewSession) { |
| 75 OkLauncher launcher; | 89 OkLauncher launcher; |
| 76 SessionMap map; | 90 SessionMap map; |
| 77 base::DictionaryValue params; | 91 base::DictionaryValue params; |
| (...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 TEST(CommandsTest, ErrorFindElement) { | 416 TEST(CommandsTest, ErrorFindElement) { |
| 403 Session session("id", scoped_ptr<Chrome>(new ErrorCallFunctionChrome())); | 417 Session session("id", scoped_ptr<Chrome>(new ErrorCallFunctionChrome())); |
| 404 base::DictionaryValue params; | 418 base::DictionaryValue params; |
| 405 params.SetString("using", "id"); | 419 params.SetString("using", "id"); |
| 406 params.SetString("value", "a"); | 420 params.SetString("value", "a"); |
| 407 scoped_ptr<base::Value> value; | 421 scoped_ptr<base::Value> value; |
| 408 ASSERT_EQ(kUnknownError, ExecuteFindElement(&session, params, &value).code()); | 422 ASSERT_EQ(kUnknownError, ExecuteFindElement(&session, params, &value).code()); |
| 409 ASSERT_EQ(kUnknownError, | 423 ASSERT_EQ(kUnknownError, |
| 410 ExecuteFindElements(&session, params, &value).code()); | 424 ExecuteFindElements(&session, params, &value).code()); |
| 411 } | 425 } |
| OLD | NEW |