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

Side by Side Diff: chrome/test/chromedriver/performance_logger_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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/performance_logger.h" 5 #include "chrome/test/chromedriver/performance_logger.h"
6 6
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "base/format_macros.h" 8 #include "base/format_macros.h"
9 #include "base/json/json_reader.h" 9 #include "base/json/json_reader.h"
10 #include "base/memory/scoped_vector.h" 10 #include "base/memory/scoped_vector.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 base::DictionaryValue empty_params; 49 base::DictionaryValue empty_params;
50 return listener_->OnEvent(this, method, empty_params); 50 return listener_->OnEvent(this, method, empty_params);
51 } 51 }
52 52
53 Status TriggerEvent(const std::string& method, 53 Status TriggerEvent(const std::string& method,
54 const base::DictionaryValue& params) { 54 const base::DictionaryValue& params) {
55 return listener_->OnEvent(this, method, params); 55 return listener_->OnEvent(this, method, params);
56 } 56 }
57 57
58 // Overridden from DevToolsClient: 58 // Overridden from DevToolsClient:
59 virtual Status ConnectIfNecessary() OVERRIDE { 59 virtual Status ConnectIfNecessary() override {
60 return listener_->OnConnected(this); 60 return listener_->OnConnected(this);
61 } 61 }
62 62
63 virtual Status SendCommandAndGetResult( 63 virtual Status SendCommandAndGetResult(
64 const std::string& method, 64 const std::string& method,
65 const base::DictionaryValue& params, 65 const base::DictionaryValue& params,
66 scoped_ptr<base::DictionaryValue>* result) OVERRIDE { 66 scoped_ptr<base::DictionaryValue>* result) override {
67 sent_commands_.push_back(new DevToolsCommand(method, 67 sent_commands_.push_back(new DevToolsCommand(method,
68 params.DeepCopy())); 68 params.DeepCopy()));
69 return Status(kOk); 69 return Status(kOk);
70 } 70 }
71 71
72 virtual void AddListener(DevToolsEventListener* listener) OVERRIDE { 72 virtual void AddListener(DevToolsEventListener* listener) override {
73 CHECK(!listener_); 73 CHECK(!listener_);
74 listener_ = listener; 74 listener_ = listener;
75 } 75 }
76 76
77 virtual const std::string& GetId() OVERRIDE { 77 virtual const std::string& GetId() override {
78 return id_; 78 return id_;
79 } 79 }
80 80
81 private: 81 private:
82 const std::string id_; // WebView id. 82 const std::string id_; // WebView id.
83 ScopedVector<DevToolsCommand> sent_commands_; // Commands that were sent. 83 ScopedVector<DevToolsCommand> sent_commands_; // Commands that were sent.
84 DevToolsEventListener* listener_; // The fake allows only one event listener. 84 DevToolsEventListener* listener_; // The fake allows only one event listener.
85 size_t command_index_; 85 size_t command_index_;
86 }; 86 };
87 87
88 struct LogEntry { 88 struct LogEntry {
89 const base::Time timestamp; 89 const base::Time timestamp;
90 const Log::Level level; 90 const Log::Level level;
91 const std::string source; 91 const std::string source;
92 const std::string message; 92 const std::string message;
93 93
94 LogEntry(const base::Time& timestamp, 94 LogEntry(const base::Time& timestamp,
95 Log::Level level, 95 Log::Level level,
96 const std::string& source, 96 const std::string& source,
97 const std::string& message) 97 const std::string& message)
98 : timestamp(timestamp), level(level), source(source), message(message) {} 98 : timestamp(timestamp), level(level), source(source), message(message) {}
99 }; 99 };
100 100
101 class FakeLog : public Log { 101 class FakeLog : public Log {
102 public: 102 public:
103 virtual void AddEntryTimestamped(const base::Time& timestamp, 103 virtual void AddEntryTimestamped(const base::Time& timestamp,
104 Level level, 104 Level level,
105 const std::string& source, 105 const std::string& source,
106 const std::string& message) OVERRIDE; 106 const std::string& message) override;
107 107
108 const ScopedVector<LogEntry>& GetEntries() { 108 const ScopedVector<LogEntry>& GetEntries() {
109 return entries_; 109 return entries_;
110 } 110 }
111 111
112 private: 112 private:
113 ScopedVector<LogEntry> entries_; 113 ScopedVector<LogEntry> entries_;
114 }; 114 };
115 115
116 void FakeLog::AddEntryTimestamped(const base::Time& timestamp, 116 void FakeLog::AddEntryTimestamped(const base::Time& timestamp,
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 events_handled_(false) {} 255 events_handled_(false) {}
256 virtual ~FakeBrowserwideClient() {} 256 virtual ~FakeBrowserwideClient() {}
257 257
258 bool events_handled() const { 258 bool events_handled() const {
259 return events_handled_; 259 return events_handled_;
260 } 260 }
261 261
262 // Overridden from DevToolsClient: 262 // Overridden from DevToolsClient:
263 virtual Status HandleEventsUntil( 263 virtual Status HandleEventsUntil(
264 const ConditionalFunc& conditional_func, 264 const ConditionalFunc& conditional_func,
265 const base::TimeDelta& timeout) OVERRIDE { 265 const base::TimeDelta& timeout) override {
266 TriggerEvent("Tracing.tracingComplete"); 266 TriggerEvent("Tracing.tracingComplete");
267 events_handled_ = true; 267 events_handled_ = true;
268 return Status(kOk); 268 return Status(kOk);
269 } 269 }
270 270
271 private: 271 private:
272 bool events_handled_; 272 bool events_handled_;
273 }; 273 };
274 274
275 } // namespace 275 } // namespace
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 std::string webview; 378 std::string webview;
379 EXPECT_TRUE(message->GetString("webview", &webview)); 379 EXPECT_TRUE(message->GetString("webview", &webview));
380 EXPECT_EQ(DevToolsClientImpl::kBrowserwideDevToolsClientId, webview); 380 EXPECT_EQ(DevToolsClientImpl::kBrowserwideDevToolsClientId, webview);
381 std::string method; 381 std::string method;
382 EXPECT_TRUE(message->GetString("message.method", &method)); 382 EXPECT_TRUE(message->GetString("message.method", &method));
383 EXPECT_EQ("Tracing.bufferUsage", method); 383 EXPECT_EQ("Tracing.bufferUsage", method);
384 base::DictionaryValue* actual_params; 384 base::DictionaryValue* actual_params;
385 EXPECT_TRUE(message->GetDictionary("message.params", &actual_params)); 385 EXPECT_TRUE(message->GetDictionary("message.params", &actual_params));
386 EXPECT_TRUE(actual_params->HasKey("error")); 386 EXPECT_TRUE(actual_params->HasKey("error"));
387 } 387 }
OLDNEW
« no previous file with comments | « chrome/test/chromedriver/performance_logger.h ('k') | chrome/test/chromedriver/server/chromedriver_server.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698