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

Side by Side Diff: chrome/test/chromedriver/chrome/console_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 (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 "chrome/test/chromedriver/chrome/console_logger.h" 5 #include "chrome/test/chromedriver/chrome/console_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/memory/scoped_vector.h" 9 #include "base/memory/scoped_vector.h"
10 #include "base/time/time.h" 10 #include "base/time/time.h"
(...skipping 19 matching lines...) Expand all
30 } 30 }
31 return command; 31 return command;
32 } 32 }
33 33
34 Status TriggerEvent(const std::string& method, 34 Status TriggerEvent(const std::string& method,
35 const base::DictionaryValue& params) { 35 const base::DictionaryValue& params) {
36 return listener_->OnEvent(this, method, params); 36 return listener_->OnEvent(this, method, params);
37 } 37 }
38 38
39 // Overridden from DevToolsClient: 39 // Overridden from DevToolsClient:
40 virtual Status ConnectIfNecessary() OVERRIDE { 40 virtual Status ConnectIfNecessary() override {
41 return listener_->OnConnected(this); 41 return listener_->OnConnected(this);
42 } 42 }
43 43
44 virtual Status SendCommandAndGetResult( 44 virtual Status SendCommandAndGetResult(
45 const std::string& method, 45 const std::string& method,
46 const base::DictionaryValue& params, 46 const base::DictionaryValue& params,
47 scoped_ptr<base::DictionaryValue>* result) OVERRIDE { 47 scoped_ptr<base::DictionaryValue>* result) override {
48 sent_command_queue_.push_back(method); 48 sent_command_queue_.push_back(method);
49 return Status(kOk); 49 return Status(kOk);
50 } 50 }
51 51
52 virtual void AddListener(DevToolsEventListener* listener) OVERRIDE { 52 virtual void AddListener(DevToolsEventListener* listener) override {
53 CHECK(!listener_); 53 CHECK(!listener_);
54 listener_ = listener; 54 listener_ = listener;
55 } 55 }
56 56
57 virtual const std::string& GetId() OVERRIDE { 57 virtual const std::string& GetId() override {
58 return id_; 58 return id_;
59 } 59 }
60 60
61 private: 61 private:
62 const std::string id_; // WebView id. 62 const std::string id_; // WebView id.
63 std::list<std::string> sent_command_queue_; // Commands that were sent. 63 std::list<std::string> sent_command_queue_; // Commands that were sent.
64 DevToolsEventListener* listener_; // The fake allows only one event listener. 64 DevToolsEventListener* listener_; // The fake allows only one event listener.
65 }; 65 };
66 66
67 struct LogEntry { 67 struct LogEntry {
68 const base::Time timestamp; 68 const base::Time timestamp;
69 const Log::Level level; 69 const Log::Level level;
70 const std::string source; 70 const std::string source;
71 const std::string message; 71 const std::string message;
72 72
73 LogEntry(const base::Time& timestamp, 73 LogEntry(const base::Time& timestamp,
74 Log::Level level, 74 Log::Level level,
75 const std::string& source, 75 const std::string& source,
76 const std::string& message) 76 const std::string& message)
77 : timestamp(timestamp), level(level), source(source), message(message) {} 77 : timestamp(timestamp), level(level), source(source), message(message) {}
78 }; 78 };
79 79
80 class FakeLog : public Log { 80 class FakeLog : public Log {
81 public: 81 public:
82 virtual void AddEntryTimestamped(const base::Time& timestamp, 82 virtual void AddEntryTimestamped(const base::Time& timestamp,
83 Level level, 83 Level level,
84 const std::string& source, 84 const std::string& source,
85 const std::string& message) OVERRIDE; 85 const std::string& message) override;
86 86
87 const ScopedVector<LogEntry>& GetEntries() { 87 const ScopedVector<LogEntry>& GetEntries() {
88 return entries_; 88 return entries_;
89 } 89 }
90 90
91 private: 91 private:
92 ScopedVector<LogEntry> entries_; 92 ScopedVector<LogEntry> entries_;
93 }; 93 };
94 94
95 void FakeLog::AddEntryTimestamped(const base::Time& timestamp, 95 void FakeLog::AddEntryTimestamped(const base::Time& timestamp,
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 ValidateLogEntry( 193 ValidateLogEntry(
194 log.GetEntries()[5], Log::kWarning, "", 194 log.GetEntries()[5], Log::kWarning, "",
195 "{\"message\":{\"column\":6,\"line\":60," 195 "{\"message\":{\"column\":6,\"line\":60,"
196 "\"source\":\"source6\",\"url\":\"url6\"}}"); 196 "\"source\":\"source6\",\"url\":\"url6\"}}");
197 ValidateLogEntry( 197 ValidateLogEntry(
198 log.GetEntries()[6], Log::kWarning, "", 198 log.GetEntries()[6], Log::kWarning, "",
199 "{\"message\":{\"level\":\"log\"," 199 "{\"message\":{\"level\":\"log\","
200 "\"source\":\"source7\",\"url\":\"url7\"}}"); 200 "\"source\":\"source7\",\"url\":\"url7\"}}");
201 ValidateLogEntry(log.GetEntries()[7], Log::kWarning, "", "{\"gaga\":8}"); 201 ValidateLogEntry(log.GetEntries()[7], Log::kWarning, "", "{\"gaga\":8}");
202 } 202 }
OLDNEW
« no previous file with comments | « chrome/test/chromedriver/chrome/console_logger.h ('k') | chrome/test/chromedriver/chrome/debugger_tracker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698