| 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" | |
| 13 #include "base/rand_util.h" | 12 #include "base/rand_util.h" |
| 14 #include "base/strings/string16.h" | 13 #include "base/strings/string16.h" |
| 15 #include "base/strings/string_util.h" | 14 #include "base/strings/string_util.h" |
| 16 #include "base/strings/stringprintf.h" | 15 #include "base/strings/stringprintf.h" |
| 17 #include "base/third_party/icu/icu_utf.h" | 16 #include "base/third_party/icu/icu_utf.h" |
| 18 #include "base/values.h" | 17 #include "base/values.h" |
| 19 #include "chrome/test/chromedriver/chrome/status.h" | 18 #include "chrome/test/chromedriver/chrome/status.h" |
| 20 #include "chrome/test/chromedriver/chrome/ui_events.h" | 19 #include "chrome/test/chromedriver/chrome/ui_events.h" |
| 21 #include "chrome/test/chromedriver/chrome/web_view.h" | 20 #include "chrome/test/chromedriver/chrome/web_view.h" |
| 22 #include "chrome/test/chromedriver/command_listener.h" | |
| 23 #include "chrome/test/chromedriver/key_converter.h" | 21 #include "chrome/test/chromedriver/key_converter.h" |
| 24 #include "chrome/test/chromedriver/session.h" | |
| 25 #include "third_party/zlib/google/zip.h" | 22 #include "third_party/zlib/google/zip.h" |
| 26 | 23 |
| 27 std::string GenerateId() { | 24 std::string GenerateId() { |
| 28 uint64 msb = base::RandUint64(); | 25 uint64 msb = base::RandUint64(); |
| 29 uint64 lsb = base::RandUint64(); | 26 uint64 lsb = base::RandUint64(); |
| 30 return base::StringPrintf("%016" PRIx64 "%016" PRIx64, msb, lsb); | 27 return base::StringPrintf("%016" PRIx64 "%016" PRIx64, msb, lsb); |
| 31 } | 28 } |
| 32 | 29 |
| 33 namespace { | 30 namespace { |
| 34 | 31 |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 397 if (first_file.empty()) | 394 if (first_file.empty()) |
| 398 return Status(kUnknownError, "contained 0 files"); | 395 return Status(kUnknownError, "contained 0 files"); |
| 399 | 396 |
| 400 base::FilePath second_file = enumerator.Next(); | 397 base::FilePath second_file = enumerator.Next(); |
| 401 if (!second_file.empty()) | 398 if (!second_file.empty()) |
| 402 return Status(kUnknownError, "contained multiple files"); | 399 return Status(kUnknownError, "contained multiple files"); |
| 403 | 400 |
| 404 *file = first_file; | 401 *file = first_file; |
| 405 return Status(kOk); | 402 return Status(kOk); |
| 406 } | 403 } |
| 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 |