| OLD | NEW |
| 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/session_commands.h" | 5 #include "chrome/test/chromedriver/session_commands.h" |
| 6 | 6 |
| 7 #include <list> | 7 #include <list> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 } | 382 } |
| 383 | 383 |
| 384 Status ExecuteGetAvailableLogTypes( | 384 Status ExecuteGetAvailableLogTypes( |
| 385 Session* session, | 385 Session* session, |
| 386 const base::DictionaryValue& params, | 386 const base::DictionaryValue& params, |
| 387 scoped_ptr<base::Value>* value) { | 387 scoped_ptr<base::Value>* value) { |
| 388 scoped_ptr<base::ListValue> types(new base::ListValue()); | 388 scoped_ptr<base::ListValue> types(new base::ListValue()); |
| 389 for (ScopedVector<WebDriverLog>::const_iterator log | 389 for (ScopedVector<WebDriverLog>::const_iterator log |
| 390 = session->devtools_logs.begin(); | 390 = session->devtools_logs.begin(); |
| 391 log != session->devtools_logs.end(); ++log) { | 391 log != session->devtools_logs.end(); ++log) { |
| 392 types->AppendString((*log)->GetType()); | 392 types->AppendString((*log)->type()); |
| 393 } | 393 } |
| 394 value->reset(types.release()); | 394 value->reset(types.release()); |
| 395 return Status(kOk); | 395 return Status(kOk); |
| 396 } | 396 } |
| 397 | 397 |
| 398 Status ExecuteGetLog( | 398 Status ExecuteGetLog( |
| 399 Session* session, | 399 Session* session, |
| 400 const base::DictionaryValue& params, | 400 const base::DictionaryValue& params, |
| 401 scoped_ptr<base::Value>* value) { | 401 scoped_ptr<base::Value>* value) { |
| 402 std::string log_type; | 402 std::string log_type; |
| 403 if (!params.GetString("type", &log_type)) { | 403 if (!params.GetString("type", &log_type)) { |
| 404 return Status(kUnknownError, "missing or invalid 'type'"); | 404 return Status(kUnknownError, "missing or invalid 'type'"); |
| 405 } | 405 } |
| 406 for (ScopedVector<WebDriverLog>::const_iterator log | 406 for (ScopedVector<WebDriverLog>::const_iterator log |
| 407 = session->devtools_logs.begin(); | 407 = session->devtools_logs.begin(); |
| 408 log != session->devtools_logs.end(); ++log) { | 408 log != session->devtools_logs.end(); ++log) { |
| 409 if (log_type == (*log)->GetType()) { | 409 if (log_type == (*log)->type()) { |
| 410 scoped_ptr<base::ListValue> log_entries = (*log)->GetAndClearEntries(); | 410 scoped_ptr<base::ListValue> log_entries = (*log)->GetAndClearEntries(); |
| 411 value->reset(log_entries.release()); | 411 value->reset(log_entries.release()); |
| 412 return Status(kOk); | 412 return Status(kOk); |
| 413 } | 413 } |
| 414 } | 414 } |
| 415 return Status(kUnknownError, "log type '" + log_type + "' not found"); | 415 return Status(kUnknownError, "log type '" + log_type + "' not found"); |
| 416 } | 416 } |
| 417 | 417 |
| 418 Status ExecuteUploadFile( | 418 Status ExecuteUploadFile( |
| 419 Session* session, | 419 Session* session, |
| (...skipping 17 matching lines...) Expand all Loading... |
| 437 } | 437 } |
| 438 std::string error_msg; | 438 std::string error_msg; |
| 439 base::FilePath upload; | 439 base::FilePath upload; |
| 440 Status status = UnzipSoleFile(upload_dir, zip_data, &upload); | 440 Status status = UnzipSoleFile(upload_dir, zip_data, &upload); |
| 441 if (status.IsError()) | 441 if (status.IsError()) |
| 442 return Status(kUnknownError, "unable to unzip 'file'", status); | 442 return Status(kUnknownError, "unable to unzip 'file'", status); |
| 443 | 443 |
| 444 value->reset(new base::StringValue(upload.value())); | 444 value->reset(new base::StringValue(upload.value())); |
| 445 return Status(kOk); | 445 return Status(kOk); |
| 446 } | 446 } |
| OLD | NEW |