Chromium Code Reviews| 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" |
| 22 #include "third_party/zlib/google/zip.h" | 24 #include "third_party/zlib/google/zip.h" |
| 23 | 25 |
| 24 std::string GenerateId() { | 26 std::string GenerateId() { |
| 25 uint64 msb = base::RandUint64(); | 27 uint64 msb = base::RandUint64(); |
| 26 uint64 lsb = base::RandUint64(); | 28 uint64 lsb = base::RandUint64(); |
| 27 return base::StringPrintf("%016" PRIx64 "%016" PRIx64, msb, lsb); | 29 return base::StringPrintf("%016" PRIx64 "%016" PRIx64, msb, lsb); |
| 28 } | 30 } |
| 29 | 31 |
| 30 namespace { | 32 namespace { |
| (...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 394 if (first_file.empty()) | 396 if (first_file.empty()) |
| 395 return Status(kUnknownError, "contained 0 files"); | 397 return Status(kUnknownError, "contained 0 files"); |
| 396 | 398 |
| 397 base::FilePath second_file = enumerator.Next(); | 399 base::FilePath second_file = enumerator.Next(); |
| 398 if (!second_file.empty()) | 400 if (!second_file.empty()) |
| 399 return Status(kUnknownError, "contained multiple files"); | 401 return Status(kUnknownError, "contained multiple files"); |
| 400 | 402 |
| 401 *file = first_file; | 403 *file = first_file; |
| 402 return Status(kOk); | 404 return Status(kOk); |
| 403 } | 405 } |
| 406 | |
| 407 void NotifySessionListenersBeforeCommand(Session* session, | |
| 408 const std::string& command_name) { | |
| 409 for (ScopedVector<CommandListener>::const_iterator it = | |
| 410 session->command_listeners.begin(); | |
|
stgao
2014/06/27 16:48:25
indent.
johnmoore
2014/06/27 21:58:03
Done.
| |
| 411 it != session->command_listeners.end(); | |
| 412 ++it) { | |
| 413 Status status = (*it)->BeforeCommand(command_name); | |
| 414 if (status.IsError()) | |
| 415 LOG(ERROR) << "Error when notifying listener of command"; | |
| 416 } | |
| 417 } | |
| OLD | NEW |