diff options
author | yzshen@chromium.org <yzshen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-25 05:17:31 +0000 |
---|---|---|
committer | yzshen@chromium.org <yzshen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-25 05:17:31 +0000 |
commit | a27695c2fabe7186abd119a7a067dc14885f88d5 (patch) | |
tree | dd08ad2c791a72b89763b3dc7f8a8693e784a006 /mojo/common | |
parent | e2233e6ebad14915b2b2b75a4f7c1aa4660d7de2 (diff) | |
download | chromium_src-a27695c2fabe7186abd119a7a067dc14885f88d5.zip chromium_src-a27695c2fabe7186abd119a7a067dc14885f88d5.tar.gz chromium_src-a27695c2fabe7186abd119a7a067dc14885f88d5.tar.bz2 |
Enable mojo js tests which depend on mojom.js files in gen/.
The tests are skipped if those mojom.js files don't exist. This is a
temporary fix before isolated tests are enabled on Chromium waterfall.
TEST=None
BUG=351214
R=sky@chromium.org
Review URL: https://codereview.chromium.org/253413004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@266135 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'mojo/common')
-rw-r--r-- | mojo/common/test/test_utils.h | 7 | ||||
-rw-r--r-- | mojo/common/test/test_utils_posix.cc | 9 | ||||
-rw-r--r-- | mojo/common/test/test_utils_win.cc | 11 |
3 files changed, 27 insertions, 0 deletions
diff --git a/mojo/common/test/test_utils.h b/mojo/common/test/test_utils.h index 369e2bf..6b9be22 100644 --- a/mojo/common/test/test_utils.h +++ b/mojo/common/test/test_utils.h @@ -7,6 +7,10 @@ #include <stddef.h> +#include <string> + +#include "base/files/file_path.h" + namespace mojo { namespace embedder { @@ -38,6 +42,9 @@ bool NonBlockingRead(const embedder::PlatformHandle& handle, size_t buffer_size, size_t* bytes_read); +// Returns the path to the mojom js bindings file. +base::FilePath GetFilePathForJSResource(const std::string& path); + } // namespace test } // namespace mojo diff --git a/mojo/common/test/test_utils_posix.cc b/mojo/common/test/test_utils_posix.cc index 254d0a8..b99ad3b 100644 --- a/mojo/common/test/test_utils_posix.cc +++ b/mojo/common/test/test_utils_posix.cc @@ -7,6 +7,8 @@ #include <fcntl.h> #include <unistd.h> +#include "base/base_paths.h" +#include "base/path_service.h" #include "base/posix/eintr_wrapper.h" #include "mojo/embedder/platform_handle.h" @@ -73,5 +75,12 @@ bool NonBlockingRead(const embedder::PlatformHandle& handle, return true; } +base::FilePath GetFilePathForJSResource(const std::string& path) { + std::string binding_path = "gen/" + path + ".js"; + base::FilePath exe_dir; + PathService::Get(base::DIR_EXE, &exe_dir); + return exe_dir.AppendASCII(binding_path); +} + } // namespace test } // namespace mojo diff --git a/mojo/common/test/test_utils_win.cc b/mojo/common/test/test_utils_win.cc index 97ec466..aaabc01 100644 --- a/mojo/common/test/test_utils_win.cc +++ b/mojo/common/test/test_utils_win.cc @@ -6,6 +6,9 @@ #include <windows.h> +#include "base/base_paths.h" +#include "base/path_service.h" +#include "base/strings/string_util.h" #include "mojo/embedder/platform_handle.h" namespace mojo { @@ -76,5 +79,13 @@ bool NonBlockingRead(const embedder::PlatformHandle& handle, return true; } +base::FilePath GetFilePathForJSResource(const std::string& path) { + std::string binding_path = "gen/" + path + ".js"; + base::ReplaceChars(binding_path, "//", "\\", &binding_path); + base::FilePath exe_dir; + PathService::Get(base::DIR_EXE, &exe_dir); + return exe_dir.AppendASCII(binding_path); +} + } // namespace test } // namespace mojo |