summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
authoryzshen@chromium.org <yzshen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-25 05:17:31 +0000
committeryzshen@chromium.org <yzshen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-25 05:17:31 +0000
commita27695c2fabe7186abd119a7a067dc14885f88d5 (patch)
treedd08ad2c791a72b89763b3dc7f8a8693e784a006 /content
parente2233e6ebad14915b2b2b75a4f7c1aa4660d7de2 (diff)
downloadchromium_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 'content')
-rw-r--r--content/browser/webui/web_ui_mojo_browsertest.cc21
-rw-r--r--content/content_tests.gypi1
2 files changed, 6 insertions, 16 deletions
diff --git a/content/browser/webui/web_ui_mojo_browsertest.cc b/content/browser/webui/web_ui_mojo_browsertest.cc
index 33cd512..368369d 100644
--- a/content/browser/webui/web_ui_mojo_browsertest.cc
+++ b/content/browser/webui/web_ui_mojo_browsertest.cc
@@ -23,6 +23,7 @@
#include "content/public/test/content_browser_test_utils.h"
#include "content/test/data/web_ui_test_mojo_bindings.mojom.h"
#include "grit/content_resources.h"
+#include "mojo/common/test/test_utils.h"
#include "mojo/public/cpp/bindings/allocation_scope.h"
#include "mojo/public/cpp/bindings/remote_ptr.h"
#include "mojo/public/js/bindings/constants.h"
@@ -60,19 +61,6 @@ const float kExpectedFloatNan = std::numeric_limits<float>::quiet_NaN();
// NaN has the property that it is not equal to itself.
#define EXPECT_NAN(x) EXPECT_NE(x, x)
-// Returns the path to the mojom js bindings file.
-base::FilePath GetFilePathForJSResource(const std::string& path) {
- std::string binding_path = "gen/" + path + ".js";
-#if defined(OS_WIN)
- std::string tmp;
- base::ReplaceChars(binding_path, "//", "\\", &tmp);
- binding_path.swap(tmp);
-#endif
- base::FilePath file_path;
- PathService::Get(CHILD_PROCESS_EXE, &file_path);
- return file_path.DirName().AppendASCII(binding_path);
-}
-
// The bindings for the page are generated from a .mojom file. This code looks
// up the generated file from disk and returns it.
bool GetResource(const std::string& id,
@@ -85,7 +73,8 @@ bool GetResource(const std::string& id,
return false;
std::string contents;
- CHECK(base::ReadFileToString(GetFilePathForJSResource(id), &contents,
+ CHECK(base::ReadFileToString(mojo::test::GetFilePathForJSResource(id),
+ &contents,
std::string::npos)) << id;
base::RefCountedString* ref_contents = new base::RefCountedString;
ref_contents->data() = contents;
@@ -335,7 +324,7 @@ IN_PROC_BROWSER_TEST_F(WebUIMojoTest, MAYBE_EndToEndPing) {
// pass.
// TODO(sky): remove this conditional when isolates support copying from gen.
const base::FilePath test_file_path(
- GetFilePathForJSResource(
+ mojo::test::GetFilePathForJSResource(
"content/test/data/web_ui_test_mojo_bindings.mojom"));
if (!base::PathExists(test_file_path)) {
LOG(WARNING) << " mojom binding file doesn't exist, assuming on isolate";
@@ -361,7 +350,7 @@ IN_PROC_BROWSER_TEST_F(WebUIMojoTest, MAYBE_EndToEndEcho) {
// pass.
// TODO(sky): remove this conditional when isolates support copying from gen.
const base::FilePath test_file_path(
- GetFilePathForJSResource(
+ mojo::test::GetFilePathForJSResource(
"content/test/data/web_ui_test_mojo_bindings.mojom"));
if (!base::PathExists(test_file_path)) {
LOG(WARNING) << " mojom binding file doesn't exist, assuming on isolate";
diff --git a/content/content_tests.gypi b/content/content_tests.gypi
index 9551464..c14b98c 100644
--- a/content/content_tests.gypi
+++ b/content/content_tests.gypi
@@ -1020,6 +1020,7 @@
'../media/media.gyp:media_test_support',
'../media/media.gyp:shared_memory_support',
'../mojo/mojo.gyp:mojo_bindings',
+ '../mojo/mojo.gyp:mojo_common_test_support',
'../mojo/mojo.gyp:mojo_environment_chromium',
'../mojo/mojo.gyp:mojo_service_manager',
'../mojo/mojo.gyp:mojo_system_impl',