| OLD | NEW | 
|---|
| 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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 111 | 111 | 
| 112 void FakeLog::AddEntryTimestamped(const base::Time& timestamp, | 112 void FakeLog::AddEntryTimestamped(const base::Time& timestamp, | 
| 113                                   Level level, | 113                                   Level level, | 
| 114                                   const std::string& source, | 114                                   const std::string& source, | 
| 115                                   const std::string& message) { | 115                                   const std::string& message) { | 
| 116   entries_.push_back(new LogEntry(timestamp, level, source, message)); | 116   entries_.push_back(new LogEntry(timestamp, level, source, message)); | 
| 117 } | 117 } | 
| 118 | 118 | 
| 119 scoped_ptr<base::DictionaryValue> ParseDictionary(const std::string& json) { | 119 scoped_ptr<base::DictionaryValue> ParseDictionary(const std::string& json) { | 
| 120   std::string error; | 120   std::string error; | 
| 121   scoped_ptr<base::Value> value(base::JSONReader::DeprecatedReadAndReturnError( | 121   scoped_ptr<base::Value> value = base::JSONReader::ReadAndReturnError( | 
| 122       json, base::JSON_PARSE_RFC, NULL, &error)); | 122       json, base::JSON_PARSE_RFC, NULL, &error); | 
| 123   if (value == NULL) { | 123   if (value == NULL) { | 
| 124     SCOPED_TRACE(json.c_str()); | 124     SCOPED_TRACE(json.c_str()); | 
| 125     SCOPED_TRACE(error.c_str()); | 125     SCOPED_TRACE(error.c_str()); | 
| 126     ADD_FAILURE(); | 126     ADD_FAILURE(); | 
| 127     return scoped_ptr<base::DictionaryValue>(); | 127     return scoped_ptr<base::DictionaryValue>(); | 
| 128   } | 128   } | 
| 129   base::DictionaryValue* dict = NULL; | 129   base::DictionaryValue* dict = NULL; | 
| 130   if (!value->GetAsDictionary(&dict)) { | 130   if (!value->GetAsDictionary(&dict)) { | 
| 131     SCOPED_TRACE("JSON object is not a dictionary"); | 131     SCOPED_TRACE("JSON object is not a dictionary"); | 
| 132     ADD_FAILURE(); | 132     ADD_FAILURE(); | 
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 372   std::string webview; | 372   std::string webview; | 
| 373   EXPECT_TRUE(message->GetString("webview", &webview)); | 373   EXPECT_TRUE(message->GetString("webview", &webview)); | 
| 374   EXPECT_EQ(DevToolsClientImpl::kBrowserwideDevToolsClientId, webview); | 374   EXPECT_EQ(DevToolsClientImpl::kBrowserwideDevToolsClientId, webview); | 
| 375   std::string method; | 375   std::string method; | 
| 376   EXPECT_TRUE(message->GetString("message.method", &method)); | 376   EXPECT_TRUE(message->GetString("message.method", &method)); | 
| 377   EXPECT_EQ("Tracing.bufferUsage", method); | 377   EXPECT_EQ("Tracing.bufferUsage", method); | 
| 378   base::DictionaryValue* actual_params; | 378   base::DictionaryValue* actual_params; | 
| 379   EXPECT_TRUE(message->GetDictionary("message.params", &actual_params)); | 379   EXPECT_TRUE(message->GetDictionary("message.params", &actual_params)); | 
| 380   EXPECT_TRUE(actual_params->HasKey("error")); | 380   EXPECT_TRUE(actual_params->HasKey("error")); | 
| 381 } | 381 } | 
| OLD | NEW | 
|---|