Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1359)

Side by Side Diff: chrome/test/chromedriver/commands_unittest.cc

Issue 637933002: Replace FINAL and OVERRIDE with their C++11 counterparts in chrome/test (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 ASSERT_TRUE(args_.get()); 288 ASSERT_TRUE(args_.get());
289 EXPECT_TRUE(expected_args->Equals(args_.get())); 289 EXPECT_TRUE(expected_args->Equals(args_.get()));
290 ASSERT_TRUE(actrual_result); 290 ASSERT_TRUE(actrual_result);
291 EXPECT_TRUE(result_->Equals(actrual_result)); 291 EXPECT_TRUE(result_->Equals(actrual_result));
292 } 292 }
293 293
294 // Overridden from WebView: 294 // Overridden from WebView:
295 virtual Status CallFunction(const std::string& frame, 295 virtual Status CallFunction(const std::string& frame,
296 const std::string& function, 296 const std::string& function,
297 const base::ListValue& args, 297 const base::ListValue& args,
298 scoped_ptr<base::Value>* result) OVERRIDE { 298 scoped_ptr<base::Value>* result) override {
299 ++current_count_; 299 ++current_count_;
300 if (scenario_ == kElementExistsTimeout || 300 if (scenario_ == kElementExistsTimeout ||
301 (scenario_ == kElementExistsQueryTwice && current_count_ == 1)) { 301 (scenario_ == kElementExistsQueryTwice && current_count_ == 1)) {
302 // Always return empty result when testing timeout. 302 // Always return empty result when testing timeout.
303 if (only_one_) 303 if (only_one_)
304 result->reset(base::Value::CreateNullValue()); 304 result->reset(base::Value::CreateNullValue());
305 else 305 else
306 result->reset(new base::ListValue()); 306 result->reset(new base::ListValue());
307 } else { 307 } else {
308 switch (scenario_) { 308 switch (scenario_) {
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
500 class ErrorCallFunctionWebView : public StubWebView { 500 class ErrorCallFunctionWebView : public StubWebView {
501 public: 501 public:
502 explicit ErrorCallFunctionWebView(StatusCode code) 502 explicit ErrorCallFunctionWebView(StatusCode code)
503 : StubWebView("1"), code_(code) {} 503 : StubWebView("1"), code_(code) {}
504 virtual ~ErrorCallFunctionWebView() {} 504 virtual ~ErrorCallFunctionWebView() {}
505 505
506 // Overridden from WebView: 506 // Overridden from WebView:
507 virtual Status CallFunction(const std::string& frame, 507 virtual Status CallFunction(const std::string& frame,
508 const std::string& function, 508 const std::string& function,
509 const base::ListValue& args, 509 const base::ListValue& args,
510 scoped_ptr<base::Value>* result) OVERRIDE { 510 scoped_ptr<base::Value>* result) override {
511 return Status(code_); 511 return Status(code_);
512 } 512 }
513 513
514 private: 514 private:
515 StatusCode code_; 515 StatusCode code_;
516 }; 516 };
517 517
518 } // namespace 518 } // namespace
519 519
520 TEST(CommandsTest, ErrorFindElement) { 520 TEST(CommandsTest, ErrorFindElement) {
(...skipping 27 matching lines...) Expand all
548 1, &session, &web_view, element_id, params, &result).code()); 548 1, &session, &web_view, element_id, params, &result).code());
549 } 549 }
550 550
551 namespace { 551 namespace {
552 552
553 class MockCommandListener : public CommandListener { 553 class MockCommandListener : public CommandListener {
554 public: 554 public:
555 MockCommandListener() : called_(false) {} 555 MockCommandListener() : called_(false) {}
556 virtual ~MockCommandListener() {} 556 virtual ~MockCommandListener() {}
557 557
558 virtual Status BeforeCommand(const std::string& command_name) OVERRIDE { 558 virtual Status BeforeCommand(const std::string& command_name) override {
559 called_ = true; 559 called_ = true;
560 EXPECT_STREQ("cmd", command_name.c_str()); 560 EXPECT_STREQ("cmd", command_name.c_str());
561 return Status(kOk); 561 return Status(kOk);
562 } 562 }
563 563
564 void VerifyCalled() { 564 void VerifyCalled() {
565 EXPECT_TRUE(called_); 565 EXPECT_TRUE(called_);
566 } 566 }
567 567
568 void VerifyNotCalled() { 568 void VerifyNotCalled() {
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
655 listener->VerifyCalled(); 655 listener->VerifyCalled();
656 } 656 }
657 657
658 namespace { 658 namespace {
659 659
660 class FailingCommandListener : public CommandListener { 660 class FailingCommandListener : public CommandListener {
661 public: 661 public:
662 FailingCommandListener() {} 662 FailingCommandListener() {}
663 virtual ~FailingCommandListener() {} 663 virtual ~FailingCommandListener() {}
664 664
665 virtual Status BeforeCommand(const std::string& command_name) OVERRIDE { 665 virtual Status BeforeCommand(const std::string& command_name) override {
666 return Status(kUnknownError); 666 return Status(kUnknownError);
667 } 667 }
668 }; 668 };
669 669
670 void AddListenerToSessionIfSessionExists(CommandListener* listener) { 670 void AddListenerToSessionIfSessionExists(CommandListener* listener) {
671 Session* session = GetThreadLocalSession(); 671 Session* session = GetThreadLocalSession();
672 if (session) { 672 if (session) {
673 session->command_listeners.push_back(listener); 673 session->command_listeners.push_back(listener);
674 } 674 }
675 } 675 }
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
721 false, 721 false,
722 params, 722 params,
723 id, 723 id,
724 base::Bind(&OnFailBecauseErrorNotifyingListeners, &run_loop)); 724 base::Bind(&OnFailBecauseErrorNotifyingListeners, &run_loop));
725 run_loop.Run(); 725 run_loop.Run();
726 726
727 thread->message_loop()->PostTask( 727 thread->message_loop()->PostTask(
728 FROM_HERE, 728 FROM_HERE,
729 base::Bind(&VerifySessionWasDeleted)); 729 base::Bind(&VerifySessionWasDeleted));
730 } 730 }
OLDNEW
« no previous file with comments | « chrome/test/chromedriver/command_listener_proxy_unittest.cc ('k') | chrome/test/chromedriver/logging.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698