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

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

Issue 653773004: Standardize usage of virtual/override/final in chrome/ (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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
(...skipping 29 matching lines...) Expand all
40 std::string data; 40 std::string data;
41 ASSERT_TRUE(base::ReadFileToString(base::FilePath(path), &data)); 41 ASSERT_TRUE(base::ReadFileToString(base::FilePath(path), &data));
42 ASSERT_STREQ("COW\n", data.c_str()); 42 ASSERT_STREQ("COW\n", data.c_str());
43 } 43 }
44 44
45 namespace { 45 namespace {
46 46
47 class DetachChrome : public StubChrome { 47 class DetachChrome : public StubChrome {
48 public: 48 public:
49 DetachChrome() : quit_called_(false) {} 49 DetachChrome() : quit_called_(false) {}
50 virtual ~DetachChrome() {} 50 ~DetachChrome() override {}
51 51
52 // Overridden from Chrome: 52 // Overridden from Chrome:
53 virtual Status Quit() override { 53 Status Quit() override {
54 quit_called_ = true; 54 quit_called_ = true;
55 return Status(kOk); 55 return Status(kOk);
56 } 56 }
57 57
58 bool quit_called_; 58 bool quit_called_;
59 }; 59 };
60 60
61 } // namespace 61 } // namespace
62 62
63 TEST(SessionCommandsTest, Quit) { 63 TEST(SessionCommandsTest, Quit) {
(...skipping 24 matching lines...) Expand all
88 88
89 ASSERT_EQ(kOk, ExecuteQuit(false, &session, params, &value).code()); 89 ASSERT_EQ(kOk, ExecuteQuit(false, &session, params, &value).code());
90 ASSERT_TRUE(chrome->quit_called_); 90 ASSERT_TRUE(chrome->quit_called_);
91 } 91 }
92 92
93 namespace { 93 namespace {
94 94
95 class FailsToQuitChrome : public StubChrome { 95 class FailsToQuitChrome : public StubChrome {
96 public: 96 public:
97 FailsToQuitChrome() {} 97 FailsToQuitChrome() {}
98 virtual ~FailsToQuitChrome() {} 98 ~FailsToQuitChrome() override {}
99 99
100 // Overridden from Chrome: 100 // Overridden from Chrome:
101 virtual Status Quit() override { 101 Status Quit() override { return Status(kUnknownError); }
102 return Status(kUnknownError);
103 }
104 }; 102 };
105 103
106 } // namespace 104 } // namespace
107 105
108 TEST(SessionCommandsTest, QuitFails) { 106 TEST(SessionCommandsTest, QuitFails) {
109 Session session("id", scoped_ptr<Chrome>(new FailsToQuitChrome())); 107 Session session("id", scoped_ptr<Chrome>(new FailsToQuitChrome()));
110 base::DictionaryValue params; 108 base::DictionaryValue params;
111 scoped_ptr<base::Value> value; 109 scoped_ptr<base::Value> value;
112 ASSERT_EQ(kUnknownError, ExecuteQuit(false, &session, params, &value).code()); 110 ASSERT_EQ(kUnknownError, ExecuteQuit(false, &session, params, &value).code());
113 } 111 }
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 status_code = ExecuteSetAutoReporting(&session, params, &value).code(); 146 status_code = ExecuteSetAutoReporting(&session, params, &value).code();
149 ASSERT_EQ(kOk, status_code); 147 ASSERT_EQ(kOk, status_code);
150 ASSERT_FALSE(session.auto_reporting_enabled); 148 ASSERT_FALSE(session.auto_reporting_enabled);
151 149
152 // check that autoreporting was disabled successfully 150 // check that autoreporting was disabled successfully
153 status_code = ExecuteIsAutoReporting(&session, params, &value).code(); 151 status_code = ExecuteIsAutoReporting(&session, params, &value).code();
154 ASSERT_EQ(kOk, status_code); 152 ASSERT_EQ(kOk, status_code);
155 ASSERT_TRUE(value.get()->GetAsBoolean(&enabled)); 153 ASSERT_TRUE(value.get()->GetAsBoolean(&enabled));
156 ASSERT_FALSE(enabled); 154 ASSERT_FALSE(enabled);
157 } 155 }
OLDNEW
« no previous file with comments | « chrome/test/chromedriver/server/chromedriver_server.cc ('k') | chrome/test/chromedriver/session_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698