| 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/util.h" | 5 #include "chrome/test/chromedriver/util.h" |
| 6 | 6 |
| 7 #include "base/base64.h" | 7 #include "base/base64.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/files/file_enumerator.h" | 9 #include "base/files/file_enumerator.h" |
| 10 #include "base/files/scoped_temp_dir.h" | 10 #include "base/files/scoped_temp_dir.h" |
| 11 #include "base/format_macros.h" | 11 #include "base/format_macros.h" |
| 12 #include "base/memory/scoped_vector.h" |
| 12 #include "base/rand_util.h" | 13 #include "base/rand_util.h" |
| 13 #include "base/strings/string16.h" | 14 #include "base/strings/string16.h" |
| 14 #include "base/strings/string_util.h" | 15 #include "base/strings/string_util.h" |
| 15 #include "base/strings/stringprintf.h" | 16 #include "base/strings/stringprintf.h" |
| 16 #include "base/third_party/icu/icu_utf.h" | 17 #include "base/third_party/icu/icu_utf.h" |
| 17 #include "base/values.h" | 18 #include "base/values.h" |
| 18 #include "chrome/test/chromedriver/chrome/status.h" | 19 #include "chrome/test/chromedriver/chrome/status.h" |
| 19 #include "chrome/test/chromedriver/chrome/ui_events.h" | 20 #include "chrome/test/chromedriver/chrome/ui_events.h" |
| 20 #include "chrome/test/chromedriver/chrome/web_view.h" | 21 #include "chrome/test/chromedriver/chrome/web_view.h" |
| 22 #include "chrome/test/chromedriver/command_listener.h" |
| 21 #include "chrome/test/chromedriver/key_converter.h" | 23 #include "chrome/test/chromedriver/key_converter.h" |
| 24 #include "chrome/test/chromedriver/session.h" |
| 22 #include "third_party/zlib/google/zip.h" | 25 #include "third_party/zlib/google/zip.h" |
| 23 | 26 |
| 24 std::string GenerateId() { | 27 std::string GenerateId() { |
| 25 uint64 msb = base::RandUint64(); | 28 uint64 msb = base::RandUint64(); |
| 26 uint64 lsb = base::RandUint64(); | 29 uint64 lsb = base::RandUint64(); |
| 27 return base::StringPrintf("%016" PRIx64 "%016" PRIx64, msb, lsb); | 30 return base::StringPrintf("%016" PRIx64 "%016" PRIx64, msb, lsb); |
| 28 } | 31 } |
| 29 | 32 |
| 30 namespace { | 33 namespace { |
| 31 | 34 |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 if (first_file.empty()) | 397 if (first_file.empty()) |
| 395 return Status(kUnknownError, "contained 0 files"); | 398 return Status(kUnknownError, "contained 0 files"); |
| 396 | 399 |
| 397 base::FilePath second_file = enumerator.Next(); | 400 base::FilePath second_file = enumerator.Next(); |
| 398 if (!second_file.empty()) | 401 if (!second_file.empty()) |
| 399 return Status(kUnknownError, "contained multiple files"); | 402 return Status(kUnknownError, "contained multiple files"); |
| 400 | 403 |
| 401 *file = first_file; | 404 *file = first_file; |
| 402 return Status(kOk); | 405 return Status(kOk); |
| 403 } | 406 } |
| 407 |
| 408 void NotifySessionListenersBeforeCommand(Session* session, |
| 409 const std::string& command_name) { |
| 410 for (ScopedVector<CommandListener>::const_iterator it = |
| 411 session->command_listeners.begin(); |
| 412 it != session->command_listeners.end(); |
| 413 ++it) { |
| 414 Status status = (*it)->BeforeCommand(command_name); |
| 415 if (status.IsError()) |
| 416 LOG(ERROR) << "Error when notifying listener of command"; |
| 417 } |
| 418 } |
| OLD | NEW |