| 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 "chrome/test/chromedriver/commands.h" | 5 #include "chrome/test/chromedriver/commands.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 365 element2.SetString("ELEMENT", "2"); | 365 element2.SetString("ELEMENT", "2"); |
| 366 base::ListValue list; | 366 base::ListValue list; |
| 367 list.Append(element1.CreateDeepCopy()); | 367 list.Append(element1.CreateDeepCopy()); |
| 368 list.Append(element2.CreateDeepCopy()); | 368 list.Append(element2.CreateDeepCopy()); |
| 369 result_ = list.CreateDeepCopy(); | 369 result_ = list.CreateDeepCopy(); |
| 370 } | 370 } |
| 371 break; | 371 break; |
| 372 } | 372 } |
| 373 case kElementNotExistsQueryOnce: { | 373 case kElementNotExistsQueryOnce: { |
| 374 if (only_one_) | 374 if (only_one_) |
| 375 result_ = base::Value::CreateNullValue(); | 375 result_ = base::MakeUnique<base::Value>(); |
| 376 else | 376 else |
| 377 result_.reset(new base::ListValue()); | 377 result_.reset(new base::ListValue()); |
| 378 break; | 378 break; |
| 379 } | 379 } |
| 380 } | 380 } |
| 381 } | 381 } |
| 382 ~FindElementWebView() override {} | 382 ~FindElementWebView() override {} |
| 383 | 383 |
| 384 void Verify(const std::string& expected_frame, | 384 void Verify(const std::string& expected_frame, |
| 385 const base::ListValue* expected_args, | 385 const base::ListValue* expected_args, |
| (...skipping 14 matching lines...) Expand all Loading... |
| 400 // Overridden from WebView: | 400 // Overridden from WebView: |
| 401 Status CallFunction(const std::string& frame, | 401 Status CallFunction(const std::string& frame, |
| 402 const std::string& function, | 402 const std::string& function, |
| 403 const base::ListValue& args, | 403 const base::ListValue& args, |
| 404 std::unique_ptr<base::Value>* result) override { | 404 std::unique_ptr<base::Value>* result) override { |
| 405 ++current_count_; | 405 ++current_count_; |
| 406 if (scenario_ == kElementExistsTimeout || | 406 if (scenario_ == kElementExistsTimeout || |
| 407 (scenario_ == kElementExistsQueryTwice && current_count_ == 1)) { | 407 (scenario_ == kElementExistsQueryTwice && current_count_ == 1)) { |
| 408 // Always return empty result when testing timeout. | 408 // Always return empty result when testing timeout. |
| 409 if (only_one_) | 409 if (only_one_) |
| 410 *result = base::Value::CreateNullValue(); | 410 *result = base::MakeUnique<base::Value>(); |
| 411 else | 411 else |
| 412 result->reset(new base::ListValue()); | 412 result->reset(new base::ListValue()); |
| 413 } else { | 413 } else { |
| 414 switch (scenario_) { | 414 switch (scenario_) { |
| 415 case kElementExistsQueryOnce: | 415 case kElementExistsQueryOnce: |
| 416 case kElementNotExistsQueryOnce: { | 416 case kElementNotExistsQueryOnce: { |
| 417 EXPECT_EQ(1, current_count_); | 417 EXPECT_EQ(1, current_count_); |
| 418 break; | 418 break; |
| 419 } | 419 } |
| 420 case kElementExistsQueryTwice: { | 420 case kElementExistsQueryTwice: { |
| (...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 832 cmd, | 832 cmd, |
| 833 false, | 833 false, |
| 834 params, | 834 params, |
| 835 id, | 835 id, |
| 836 base::Bind(&OnFailBecauseErrorNotifyingListeners, &run_loop)); | 836 base::Bind(&OnFailBecauseErrorNotifyingListeners, &run_loop)); |
| 837 run_loop.Run(); | 837 run_loop.Run(); |
| 838 | 838 |
| 839 thread->task_runner()->PostTask(FROM_HERE, | 839 thread->task_runner()->PostTask(FROM_HERE, |
| 840 base::Bind(&VerifySessionWasDeleted)); | 840 base::Bind(&VerifySessionWasDeleted)); |
| 841 } | 841 } |
| OLD | NEW |