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 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
500 base::DictionaryValue params; | 514 base::DictionaryValue params; |
501 params.SetString("using", "id"); | 515 params.SetString("using", "id"); |
502 params.SetString("value", "a"); | 516 params.SetString("value", "a"); |
503 params.SetString("id", "1"); | 517 params.SetString("id", "1"); |
504 scoped_ptr<base::Value> value; | 518 scoped_ptr<base::Value> value; |
505 ASSERT_EQ(kStaleElementReference, | 519 ASSERT_EQ(kStaleElementReference, |
506 ExecuteFindChildElement(1, &session, params, &value).code()); | 520 ExecuteFindChildElement(1, &session, params, &value).code()); |
507 ASSERT_EQ(kStaleElementReference, | 521 ASSERT_EQ(kStaleElementReference, |
508 ExecuteFindChildElements(1, &session, params, &value).code()); | 522 ExecuteFindChildElements(1, &session, params, &value).code()); |
509 } | 523 } |
OLD | NEW |