summaryrefslogtreecommitdiffstats
path: root/ppapi
diff options
context:
space:
mode:
authordmichael@chromium.org <dmichael@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-08 22:37:28 +0000
committerdmichael@chromium.org <dmichael@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-08 22:37:28 +0000
commit3f364cbe2565b02b0cf24e09b65638e40d352697 (patch)
tree1fbd0d1fbd640f337bc5827a82fa50b0bb637cb9 /ppapi
parent0368e3967bd1b3191257895cfc4a042b01980525 (diff)
downloadchromium_src-3f364cbe2565b02b0cf24e09b65638e40d352697.zip
chromium_src-3f364cbe2565b02b0cf24e09b65638e40d352697.tar.gz
chromium_src-3f364cbe2565b02b0cf24e09b65638e40d352697.tar.bz2
Make it possible to enable/disable specific ppapi tests. Migrate PostMessage tests.
Most of these files were changed by a sed script, so it's not as bad as it looks. The testcase attribute now can include a 'filter'. If it's omitted, everything works the same as before. This way we can migrate tests over bit-by-bit if we want to. We can also still run the tests manually the same way as before. This only runs PostMessage testss the new way, and re-enables all oop PostMessage tests that pass on Windows. I can do the other tests in this CL if desired, but it might be easier to land in a few pieces. BUG=102885,95557 TEST=N/A Review URL: http://codereview.chromium.org/8477015 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@109114 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi')
-rw-r--r--ppapi/tests/test_broker.cc6
-rw-r--r--ppapi/tests/test_broker.h4
-rw-r--r--ppapi/tests/test_buffer.cc2
-rw-r--r--ppapi/tests/test_buffer.h2
-rw-r--r--ppapi/tests/test_case.cc6
-rw-r--r--ppapi/tests/test_case.h31
-rw-r--r--ppapi/tests/test_char_set.cc8
-rw-r--r--ppapi/tests/test_char_set.h4
-rw-r--r--ppapi/tests/test_core.cc6
-rw-r--r--ppapi/tests/test_core.h2
-rw-r--r--ppapi/tests/test_crypto.cc4
-rw-r--r--ppapi/tests/test_crypto.h4
-rw-r--r--ppapi/tests/test_cursor_control.cc6
-rw-r--r--ppapi/tests/test_cursor_control.h4
-rw-r--r--ppapi/tests/test_directory_reader.cc4
-rw-r--r--ppapi/tests/test_directory_reader.h4
-rw-r--r--ppapi/tests/test_file_io.cc18
-rw-r--r--ppapi/tests/test_file_io.h2
-rw-r--r--ppapi/tests/test_file_ref.cc20
-rw-r--r--ppapi/tests/test_file_ref.h2
-rw-r--r--ppapi/tests/test_file_system.cc6
-rw-r--r--ppapi/tests/test_file_system.h2
-rw-r--r--ppapi/tests/test_flash_clipboard.cc4
-rw-r--r--ppapi/tests/test_flash_clipboard.h2
-rw-r--r--ppapi/tests/test_flash_fullscreen.cc6
-rw-r--r--ppapi/tests/test_flash_fullscreen.h2
-rw-r--r--ppapi/tests/test_fullscreen.cc6
-rw-r--r--ppapi/tests/test_fullscreen.h2
-rw-r--r--ppapi/tests/test_graphics_2d.cc20
-rw-r--r--ppapi/tests/test_graphics_2d.h2
-rw-r--r--ppapi/tests/test_graphics_3d.cc4
-rw-r--r--ppapi/tests/test_graphics_3d.h2
-rw-r--r--ppapi/tests/test_image_data.cc2
-rw-r--r--ppapi/tests/test_image_data.h4
-rw-r--r--ppapi/tests/test_instance_deprecated.cc6
-rw-r--r--ppapi/tests/test_instance_deprecated.h4
-rw-r--r--ppapi/tests/test_memory.cc6
-rw-r--r--ppapi/tests/test_memory.h2
-rw-r--r--ppapi/tests/test_paint_aggregator.cc44
-rw-r--r--ppapi/tests/test_paint_aggregator.h4
-rw-r--r--ppapi/tests/test_post_message.cc32
-rw-r--r--ppapi/tests/test_post_message.h2
-rw-r--r--ppapi/tests/test_scrollbar.cc2
-rw-r--r--ppapi/tests/test_scrollbar.h4
-rw-r--r--ppapi/tests/test_transport.cc16
-rw-r--r--ppapi/tests/test_transport.h2
-rw-r--r--ppapi/tests/test_uma.cc2
-rw-r--r--ppapi/tests/test_uma.h2
-rw-r--r--ppapi/tests/test_url_loader.cc42
-rw-r--r--ppapi/tests/test_url_loader.h2
-rw-r--r--ppapi/tests/test_url_util.cc16
-rw-r--r--ppapi/tests/test_url_util.h2
-rw-r--r--ppapi/tests/test_var.cc16
-rw-r--r--ppapi/tests/test_var.h2
-rw-r--r--ppapi/tests/test_var_deprecated.cc20
-rw-r--r--ppapi/tests/test_var_deprecated.h2
-rw-r--r--ppapi/tests/test_video_decoder.cc4
-rw-r--r--ppapi/tests/test_video_decoder.h2
-rw-r--r--ppapi/tests/testing_instance.cc15
-rw-r--r--ppapi/tests/testing_instance.h18
60 files changed, 257 insertions, 215 deletions
diff --git a/ppapi/tests/test_broker.cc b/ppapi/tests/test_broker.cc
index b1d5b02..cfc60fb 100644
--- a/ppapi/tests/test_broker.cc
+++ b/ppapi/tests/test_broker.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -22,8 +22,8 @@ bool TestBroker::Init() {
return !!broker_interface_;
}
-void TestBroker::RunTest() {
- RUN_TEST(Create);
+void TestBroker::RunTests(const std::string& filter) {
+ RUN_TEST(Create, filter);
}
std::string TestBroker::TestCreate() {
diff --git a/ppapi/tests/test_broker.h b/ppapi/tests/test_broker.h
index 4cef9e5..c11d2f8 100644
--- a/ppapi/tests/test_broker.h
+++ b/ppapi/tests/test_broker.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -18,7 +18,7 @@ class TestBroker : public TestCase {
// TestCase implementation.
virtual bool Init();
- virtual void RunTest();
+ virtual void RunTests(const std::string& filter);
private:
std::string TestCreate();
diff --git a/ppapi/tests/test_buffer.cc b/ppapi/tests/test_buffer.cc
index b44047b..902bd2f 100644
--- a/ppapi/tests/test_buffer.cc
+++ b/ppapi/tests/test_buffer.cc
@@ -19,7 +19,7 @@ bool TestBuffer::Init() {
return !!buffer_interface_;
}
-void TestBuffer::RunTest() {
+void TestBuffer::RunTests(const std::string& filter) {
instance_->LogTest("InvalidSize", TestInvalidSize());
instance_->LogTest("InitToZero", TestInitToZero());
instance_->LogTest("IsBuffer", TestIsBuffer());
diff --git a/ppapi/tests/test_buffer.h b/ppapi/tests/test_buffer.h
index ede075c..7dea017 100644
--- a/ppapi/tests/test_buffer.h
+++ b/ppapi/tests/test_buffer.h
@@ -17,7 +17,7 @@ class TestBuffer : public TestCase {
// TestCase implementation.
virtual bool Init();
- virtual void RunTest();
+ virtual void RunTests(const std::string& filter);
private:
std::string TestInvalidSize();
diff --git a/ppapi/tests/test_case.cc b/ppapi/tests/test_case.cc
index 8245c25..bcee6c3 100644
--- a/ppapi/tests/test_case.cc
+++ b/ppapi/tests/test_case.cc
@@ -88,3 +88,9 @@ bool TestCase::EnsureRunningOverHTTP() {
return true;
}
+
+bool TestCase::MatchesFilter(const std::string& test_name,
+ const std::string& filter) {
+ return filter.empty() || (test_name == filter);
+}
+
diff --git a/ppapi/tests/test_case.h b/ppapi/tests/test_case.h
index 05e0d32..e974c50 100644
--- a/ppapi/tests/test_case.h
+++ b/ppapi/tests/test_case.h
@@ -37,9 +37,12 @@ class TestCase {
// Default implementation just returns true.
virtual bool Init();
- // Override to implement the test. It will be called after the plugin is
- // first displayed.
- virtual void RunTest() = 0;
+ // Override to implement the test case. It will be called after the plugin is
+ // first displayed, passing a string. If the string is empty, the
+ // should run all tests for this test case. Otherwise, it should run the test
+ // whose name matches test_filter exactly (if there is one). This should
+ // generally be implemented using the RUN_TEST* macros.
+ virtual void RunTests(const std::string& test_filter) = 0;
static std::string MakeFailureMessage(const char* file, int line,
const char* cmd);
@@ -83,6 +86,10 @@ class TestCase {
// Makes sure the test is run over HTTP.
bool EnsureRunningOverHTTP();
+ // Return true if the given test name matches the filter. This is true if
+ // (a) filter is empty or (b) test_name and filter match exactly.
+ bool MatchesFilter(const std::string& test_name, const std::string& filter);
+
// Pointer to the instance that owns us.
TestingInstance* instance_;
@@ -140,24 +147,24 @@ class TestCaseFactory {
// Helper macro for calling functions implementing specific tests in the
// RunTest function. This assumes the function name is TestFoo where Foo is the
// test |name|.
-#define RUN_TEST(name) \
- do { \
+#define RUN_TEST(name, test_filter) \
+ if (MatchesFilter(#name, test_filter)) { \
force_async_ = false; \
instance_->LogTest(#name, Test##name()); \
- } while (false)
+ }
// Like RUN_TEST above but forces functions taking callbacks to complete
// asynchronously on success or error.
-#define RUN_TEST_FORCEASYNC(name) \
- do { \
+#define RUN_TEST_FORCEASYNC(name, test_filter) \
+ if (MatchesFilter(#name"ForceAsync", test_filter)) { \
force_async_ = true; \
instance_->LogTest(#name"ForceAsync", Test##name()); \
- } while (false)
+ }
-#define RUN_TEST_FORCEASYNC_AND_NOT(name) \
+#define RUN_TEST_FORCEASYNC_AND_NOT(name, test_filter) \
do { \
- RUN_TEST_FORCEASYNC(name); \
- RUN_TEST(name); \
+ RUN_TEST_FORCEASYNC(name, test_filter); \
+ RUN_TEST(name, test_filter); \
} while (false)
diff --git a/ppapi/tests/test_char_set.cc b/ppapi/tests/test_char_set.cc
index 5c7ae69..05e32c9 100644
--- a/ppapi/tests/test_char_set.cc
+++ b/ppapi/tests/test_char_set.cc
@@ -22,10 +22,10 @@ bool TestCharSet::Init() {
return !!char_set_interface_;
}
-void TestCharSet::RunTest() {
- RUN_TEST(UTF16ToCharSet);
- RUN_TEST(CharSetToUTF16);
- RUN_TEST(GetDefaultCharSet);
+void TestCharSet::RunTests(const std::string& filter) {
+ RUN_TEST(UTF16ToCharSet, filter);
+ RUN_TEST(CharSetToUTF16, filter);
+ RUN_TEST(GetDefaultCharSet, filter);
}
std::string TestCharSet::TestUTF16ToCharSet() {
diff --git a/ppapi/tests/test_char_set.h b/ppapi/tests/test_char_set.h
index c6a14fe..3183e18 100644
--- a/ppapi/tests/test_char_set.h
+++ b/ppapi/tests/test_char_set.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -19,7 +19,7 @@ class TestCharSet : public TestCase {
// TestCase implementation.
virtual bool Init();
- virtual void RunTest();
+ virtual void RunTests(const std::string& filter);
private:
std::string TestUTF16ToCharSet();
diff --git a/ppapi/tests/test_core.cc b/ppapi/tests/test_core.cc
index 82f93613..7686c30 100644
--- a/ppapi/tests/test_core.cc
+++ b/ppapi/tests/test_core.cc
@@ -32,9 +32,9 @@ bool TestCore::Init() {
return true;
}
-void TestCore::RunTest() {
- RUN_TEST(Time);
- RUN_TEST(TimeTicks);
+void TestCore::RunTests(const std::string& filter) {
+ RUN_TEST(Time, filter);
+ RUN_TEST(TimeTicks, filter);
}
std::string TestCore::TestTime() {
diff --git a/ppapi/tests/test_core.h b/ppapi/tests/test_core.h
index 2b5899a..0c1632b 100644
--- a/ppapi/tests/test_core.h
+++ b/ppapi/tests/test_core.h
@@ -18,7 +18,7 @@ class TestCore : public TestCase {
private:
// TestCase implementation.
virtual bool Init();
- virtual void RunTest();
+ virtual void RunTests(const std::string& filter);
std::string TestTime();
std::string TestTimeTicks();
diff --git a/ppapi/tests/test_crypto.cc b/ppapi/tests/test_crypto.cc
index b91f3a8..8371e61 100644
--- a/ppapi/tests/test_crypto.cc
+++ b/ppapi/tests/test_crypto.cc
@@ -21,8 +21,8 @@ bool TestCrypto::Init() {
return !!crypto_interface_;
}
-void TestCrypto::RunTest() {
- RUN_TEST(GetRandomBytes);
+void TestCrypto::RunTests(const std::string& filter) {
+ RUN_TEST(GetRandomBytes, filter);
}
std::string TestCrypto::TestGetRandomBytes() {
diff --git a/ppapi/tests/test_crypto.h b/ppapi/tests/test_crypto.h
index 39ef600..681e648 100644
--- a/ppapi/tests/test_crypto.h
+++ b/ppapi/tests/test_crypto.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -18,7 +18,7 @@ class TestCrypto : public TestCase {
// TestCase implementation.
virtual bool Init();
- virtual void RunTest();
+ virtual void RunTests(const std::string& filter);
private:
std::string TestGetRandomBytes();
diff --git a/ppapi/tests/test_cursor_control.cc b/ppapi/tests/test_cursor_control.cc
index 80aca34..55e5225 100644
--- a/ppapi/tests/test_cursor_control.cc
+++ b/ppapi/tests/test_cursor_control.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -21,8 +21,8 @@ bool TestCursorControl::Init() {
return !!cursor_control_interface_;
}
-void TestCursorControl::RunTest() {
- RUN_TEST(SetCursor);
+void TestCursorControl::RunTests(const std::string& filter) {
+ RUN_TEST(SetCursor, filter);
}
std::string TestCursorControl::TestSetCursor() {
diff --git a/ppapi/tests/test_cursor_control.h b/ppapi/tests/test_cursor_control.h
index 65bc7a9..0159660 100644
--- a/ppapi/tests/test_cursor_control.h
+++ b/ppapi/tests/test_cursor_control.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -18,7 +18,7 @@ class TestCursorControl : public TestCase {
// TestCase implementation.
virtual bool Init();
- virtual void RunTest();
+ virtual void RunTests(const std::string& filter);
private:
std::string TestSetCursor();
diff --git a/ppapi/tests/test_directory_reader.cc b/ppapi/tests/test_directory_reader.cc
index 17d2ae3..3823f29 100644
--- a/ppapi/tests/test_directory_reader.cc
+++ b/ppapi/tests/test_directory_reader.cc
@@ -75,8 +75,8 @@ bool TestDirectoryReader::Init() {
return InitTestingInterface() && EnsureRunningOverHTTP();
}
-void TestDirectoryReader::RunTest() {
- RUN_TEST(GetNextFile);
+void TestDirectoryReader::RunTests(const std::string& filter) {
+ RUN_TEST(GetNextFile, filter);
}
std::string TestDirectoryReader::TestGetNextFile() {
diff --git a/ppapi/tests/test_directory_reader.h b/ppapi/tests/test_directory_reader.h
index 932d1b3..8f68530 100644
--- a/ppapi/tests/test_directory_reader.h
+++ b/ppapi/tests/test_directory_reader.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -16,7 +16,7 @@ class TestDirectoryReader : public TestCase {
// TestCase implementation.
virtual bool Init();
- virtual void RunTest();
+ virtual void RunTests(const std::string& filter);
private:
std::string TestGetNextFile();
diff --git a/ppapi/tests/test_file_io.cc b/ppapi/tests/test_file_io.cc
index d245b87..79995ff 100644
--- a/ppapi/tests/test_file_io.cc
+++ b/ppapi/tests/test_file_io.cc
@@ -111,15 +111,15 @@ bool TestFileIO::Init() {
return InitTestingInterface() && EnsureRunningOverHTTP();
}
-void TestFileIO::RunTest() {
- RUN_TEST_FORCEASYNC_AND_NOT(Open);
- RUN_TEST_FORCEASYNC_AND_NOT(ReadWriteSetLength);
- RUN_TEST_FORCEASYNC_AND_NOT(TouchQuery);
- RUN_TEST_FORCEASYNC_AND_NOT(AbortCalls);
- RUN_TEST_FORCEASYNC_AND_NOT(ParallelReads);
- RUN_TEST_FORCEASYNC_AND_NOT(ParallelWrites);
- RUN_TEST_FORCEASYNC_AND_NOT(NotAllowMixedReadWrite);
- RUN_TEST_FORCEASYNC_AND_NOT(WillWriteWillSetLength);
+void TestFileIO::RunTests(const std::string& filter) {
+ RUN_TEST_FORCEASYNC_AND_NOT(Open, filter);
+ RUN_TEST_FORCEASYNC_AND_NOT(ReadWriteSetLength, filter);
+ RUN_TEST_FORCEASYNC_AND_NOT(TouchQuery, filter);
+ RUN_TEST_FORCEASYNC_AND_NOT(AbortCalls, filter);
+ RUN_TEST_FORCEASYNC_AND_NOT(ParallelReads, filter);
+ RUN_TEST_FORCEASYNC_AND_NOT(ParallelWrites, filter);
+ RUN_TEST_FORCEASYNC_AND_NOT(NotAllowMixedReadWrite, filter);
+ RUN_TEST_FORCEASYNC_AND_NOT(WillWriteWillSetLength, filter);
// TODO(viettrungluu): add tests:
// - that PP_ERROR_PENDING is correctly returned
diff --git a/ppapi/tests/test_file_io.h b/ppapi/tests/test_file_io.h
index 016fdef..b971105 100644
--- a/ppapi/tests/test_file_io.h
+++ b/ppapi/tests/test_file_io.h
@@ -19,7 +19,7 @@ class TestFileIO : public TestCase {
// TestCase implementation.
virtual bool Init();
- virtual void RunTest();
+ virtual void RunTests(const std::string& filter);
private:
enum OpenExpectation {
diff --git a/ppapi/tests/test_file_ref.cc b/ppapi/tests/test_file_ref.cc
index d6b3b36..b17450d 100644
--- a/ppapi/tests/test_file_ref.cc
+++ b/ppapi/tests/test_file_ref.cc
@@ -44,16 +44,16 @@ bool TestFileRef::Init() {
return InitTestingInterface() && EnsureRunningOverHTTP();
}
-void TestFileRef::RunTest() {
- RUN_TEST_FORCEASYNC_AND_NOT(Create);
- RUN_TEST_FORCEASYNC_AND_NOT(GetFileSystemType);
- RUN_TEST_FORCEASYNC_AND_NOT(GetName);
- RUN_TEST_FORCEASYNC_AND_NOT(GetPath);
- RUN_TEST_FORCEASYNC_AND_NOT(GetParent);
- RUN_TEST_FORCEASYNC_AND_NOT(MakeDirectory);
- RUN_TEST_FORCEASYNC_AND_NOT(QueryAndTouchFile);
- RUN_TEST_FORCEASYNC_AND_NOT(DeleteFileAndDirectory);
- RUN_TEST_FORCEASYNC_AND_NOT(RenameFileAndDirectory);
+void TestFileRef::RunTests(const std::string& filter) {
+ RUN_TEST_FORCEASYNC_AND_NOT(Create, filter);
+ RUN_TEST_FORCEASYNC_AND_NOT(GetFileSystemType, filter);
+ RUN_TEST_FORCEASYNC_AND_NOT(GetName, filter);
+ RUN_TEST_FORCEASYNC_AND_NOT(GetPath, filter);
+ RUN_TEST_FORCEASYNC_AND_NOT(GetParent, filter);
+ RUN_TEST_FORCEASYNC_AND_NOT(MakeDirectory, filter);
+ RUN_TEST_FORCEASYNC_AND_NOT(QueryAndTouchFile, filter);
+ RUN_TEST_FORCEASYNC_AND_NOT(DeleteFileAndDirectory, filter);
+ RUN_TEST_FORCEASYNC_AND_NOT(RenameFileAndDirectory, filter);
}
std::string TestFileRef::TestCreate() {
diff --git a/ppapi/tests/test_file_ref.h b/ppapi/tests/test_file_ref.h
index 63df14e..e162815 100644
--- a/ppapi/tests/test_file_ref.h
+++ b/ppapi/tests/test_file_ref.h
@@ -15,7 +15,7 @@ class TestFileRef : public TestCase {
// TestCase implementation.
virtual bool Init();
- virtual void RunTest();
+ virtual void RunTests(const std::string& filter);
private:
std::string TestCreate();
diff --git a/ppapi/tests/test_file_system.cc b/ppapi/tests/test_file_system.cc
index cb37284..2b5a0c5 100644
--- a/ppapi/tests/test_file_system.cc
+++ b/ppapi/tests/test_file_system.cc
@@ -17,9 +17,9 @@ bool TestFileSystem::Init() {
return InitTestingInterface() && EnsureRunningOverHTTP();
}
-void TestFileSystem::RunTest() {
- RUN_TEST_FORCEASYNC_AND_NOT(Open);
- RUN_TEST_FORCEASYNC_AND_NOT(MultipleOpens);
+void TestFileSystem::RunTests(const std::string& filter) {
+ RUN_TEST_FORCEASYNC_AND_NOT(Open, filter);
+ RUN_TEST_FORCEASYNC_AND_NOT(MultipleOpens, filter);
}
std::string TestFileSystem::TestOpen() {
diff --git a/ppapi/tests/test_file_system.h b/ppapi/tests/test_file_system.h
index 3a200f2..3838a4a 100644
--- a/ppapi/tests/test_file_system.h
+++ b/ppapi/tests/test_file_system.h
@@ -15,7 +15,7 @@ class TestFileSystem : public TestCase {
// TestCase implementation.
virtual bool Init();
- virtual void RunTest();
+ virtual void RunTests(const std::string& filter);
private:
std::string TestOpen();
diff --git a/ppapi/tests/test_flash_clipboard.cc b/ppapi/tests/test_flash_clipboard.cc
index 600dad3..e112baf 100644
--- a/ppapi/tests/test_flash_clipboard.cc
+++ b/ppapi/tests/test_flash_clipboard.cc
@@ -22,8 +22,8 @@ bool TestFlashClipboard::Init() {
return !!clipboard_interface_;
}
-void TestFlashClipboard::RunTest() {
- RUN_TEST(ReadWrite);
+void TestFlashClipboard::RunTests(const std::string& filter) {
+ RUN_TEST(ReadWrite, filter);
}
std::string TestFlashClipboard::TestReadWrite() {
diff --git a/ppapi/tests/test_flash_clipboard.h b/ppapi/tests/test_flash_clipboard.h
index eacf933..06d3781 100644
--- a/ppapi/tests/test_flash_clipboard.h
+++ b/ppapi/tests/test_flash_clipboard.h
@@ -17,7 +17,7 @@ class TestFlashClipboard : public TestCase {
// TestCase implementation.
virtual bool Init();
- virtual void RunTest();
+ virtual void RunTests(const std::string& filter);
private:
std::string TestReadWrite();
diff --git a/ppapi/tests/test_flash_fullscreen.cc b/ppapi/tests/test_flash_fullscreen.cc
index 09e0b18..f7f122b 100644
--- a/ppapi/tests/test_flash_fullscreen.cc
+++ b/ppapi/tests/test_flash_fullscreen.cc
@@ -49,9 +49,9 @@ bool TestFlashFullscreen::Init() {
return InitTestingInterface();
}
-void TestFlashFullscreen::RunTest() {
- RUN_TEST(GetScreenSize);
- RUN_TEST(NormalToFullscreenToNormal);
+void TestFlashFullscreen::RunTests(const std::string& filter) {
+ RUN_TEST(GetScreenSize, filter);
+ RUN_TEST(NormalToFullscreenToNormal, filter);
}
std::string TestFlashFullscreen::TestGetScreenSize() {
diff --git a/ppapi/tests/test_flash_fullscreen.h b/ppapi/tests/test_flash_fullscreen.h
index 539a84f..b5d6daf 100644
--- a/ppapi/tests/test_flash_fullscreen.h
+++ b/ppapi/tests/test_flash_fullscreen.h
@@ -22,7 +22,7 @@ class TestFlashFullscreen : public TestCase {
// TestCase implementation.
virtual bool Init();
- virtual void RunTest();
+ virtual void RunTests(const std::string& filter);
virtual void DidChangeView(const pp::Rect& position, const pp::Rect& clip);
private:
diff --git a/ppapi/tests/test_fullscreen.cc b/ppapi/tests/test_fullscreen.cc
index db535d5..b16f694 100644
--- a/ppapi/tests/test_fullscreen.cc
+++ b/ppapi/tests/test_fullscreen.cc
@@ -50,9 +50,9 @@ bool TestFullscreen::Init() {
return InitTestingInterface();
}
-void TestFullscreen::RunTest() {
- RUN_TEST(GetScreenSize);
- RUN_TEST(NormalToFullscreenToNormal);
+void TestFullscreen::RunTests(const std::string& filter) {
+ RUN_TEST(GetScreenSize, filter);
+ RUN_TEST(NormalToFullscreenToNormal, filter);
}
bool TestFullscreen::GotError() {
diff --git a/ppapi/tests/test_fullscreen.h b/ppapi/tests/test_fullscreen.h
index 6f2f127..b80607db 100644
--- a/ppapi/tests/test_fullscreen.h
+++ b/ppapi/tests/test_fullscreen.h
@@ -24,7 +24,7 @@ class TestFullscreen : public TestCase {
// TestCase implementation.
virtual bool Init();
- virtual void RunTest();
+ virtual void RunTests(const std::string& filter);
virtual bool HandleInputEvent(const pp::InputEvent& event);
virtual void DidChangeView(const pp::Rect& position, const pp::Rect& clip);
diff --git a/ppapi/tests/test_graphics_2d.cc b/ppapi/tests/test_graphics_2d.cc
index e46bea9..38b5d11 100644
--- a/ppapi/tests/test_graphics_2d.cc
+++ b/ppapi/tests/test_graphics_2d.cc
@@ -41,16 +41,16 @@ bool TestGraphics2D::Init() {
InitTestingInterface();
}
-void TestGraphics2D::RunTest() {
- RUN_TEST(InvalidResource);
- RUN_TEST(InvalidSize);
- RUN_TEST(Humongous);
- RUN_TEST(InitToZero);
- RUN_TEST(Describe);
- RUN_TEST_FORCEASYNC_AND_NOT(Paint);
- // RUN_TEST_FORCEASYNC_AND_NOT(Scroll); // TODO(brettw) implement.
- RUN_TEST_FORCEASYNC_AND_NOT(Replace);
- RUN_TEST_FORCEASYNC_AND_NOT(Flush);
+void TestGraphics2D::RunTests(const std::string& filter) {
+ RUN_TEST(InvalidResource, filter);
+ RUN_TEST(InvalidSize, filter);
+ RUN_TEST(Humongous, filter);
+ RUN_TEST(InitToZero, filter);
+ RUN_TEST(Describe, filter);
+ RUN_TEST_FORCEASYNC_AND_NOT(Paint, filter);
+ // RUN_TEST_FORCEASYNC_AND_NOT(Scroll); // TODO(brettw, filter) implement.
+ RUN_TEST_FORCEASYNC_AND_NOT(Replace, filter);
+ RUN_TEST_FORCEASYNC_AND_NOT(Flush, filter);
}
void TestGraphics2D::QuitMessageLoop() {
diff --git a/ppapi/tests/test_graphics_2d.h b/ppapi/tests/test_graphics_2d.h
index 95ba7ef..36e4415 100644
--- a/ppapi/tests/test_graphics_2d.h
+++ b/ppapi/tests/test_graphics_2d.h
@@ -25,7 +25,7 @@ class TestGraphics2D : public TestCase {
// TestCase implementation.
virtual bool Init();
- virtual void RunTest();
+ virtual void RunTests(const std::string& filter);
void QuitMessageLoop();
diff --git a/ppapi/tests/test_graphics_3d.cc b/ppapi/tests/test_graphics_3d.cc
index ea6aa05..4bdd09d 100644
--- a/ppapi/tests/test_graphics_3d.cc
+++ b/ppapi/tests/test_graphics_3d.cc
@@ -21,8 +21,8 @@ bool TestGraphics3D::Init() {
return opengl_es2_ && InitTestingInterface();
}
-void TestGraphics3D::RunTest() {
- RUN_TEST(Frame);
+void TestGraphics3D::RunTests(const std::string& filter) {
+ RUN_TEST(Frame, filter);
}
std::string TestGraphics3D::TestFrame() {
diff --git a/ppapi/tests/test_graphics_3d.h b/ppapi/tests/test_graphics_3d.h
index e671230..7f694b5 100644
--- a/ppapi/tests/test_graphics_3d.h
+++ b/ppapi/tests/test_graphics_3d.h
@@ -20,7 +20,7 @@ class TestGraphics3D : public TestCase {
// TestCase implementation.
virtual bool Init();
- virtual void RunTest();
+ virtual void RunTests(const std::string& filter);
private:
// Various tests.
diff --git a/ppapi/tests/test_image_data.cc b/ppapi/tests/test_image_data.cc
index ed130cd..cd56a52 100644
--- a/ppapi/tests/test_image_data.cc
+++ b/ppapi/tests/test_image_data.cc
@@ -18,7 +18,7 @@ bool TestImageData::Init() {
return !!image_data_interface_;
}
-void TestImageData::RunTest() {
+void TestImageData::RunTests(const std::string& filter) {
instance_->LogTest("InvalidFormat", TestInvalidFormat());
instance_->LogTest("InvalidSize", TestInvalidSize());
instance_->LogTest("HugeSize", TestHugeSize());
diff --git a/ppapi/tests/test_image_data.h b/ppapi/tests/test_image_data.h
index c3f7dcd..e6fb969c 100644
--- a/ppapi/tests/test_image_data.h
+++ b/ppapi/tests/test_image_data.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -15,7 +15,7 @@ class TestImageData : public TestCase {
// TestCase implementation.
virtual bool Init();
- virtual void RunTest();
+ virtual void RunTests(const std::string& filter);
private:
std::string TestInvalidFormat();
diff --git a/ppapi/tests/test_instance_deprecated.cc b/ppapi/tests/test_instance_deprecated.cc
index 9ff1e7e..a62f202 100644
--- a/ppapi/tests/test_instance_deprecated.cc
+++ b/ppapi/tests/test_instance_deprecated.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -77,8 +77,8 @@ bool TestInstance::Init() {
return true;
}
-void TestInstance::RunTest() {
- RUN_TEST(ExecuteScript);
+void TestInstance::RunTests(const std::string& filter) {
+ RUN_TEST(ExecuteScript, filter);
}
pp::deprecated::ScriptableObject* TestInstance::CreateTestObject() {
diff --git a/ppapi/tests/test_instance_deprecated.h b/ppapi/tests/test_instance_deprecated.h
index fdd7174..8b81501 100644
--- a/ppapi/tests/test_instance_deprecated.h
+++ b/ppapi/tests/test_instance_deprecated.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -16,7 +16,7 @@ class TestInstance : public TestCase {
// TestCase implementation.
virtual bool Init();
- virtual void RunTest();
+ virtual void RunTests(const std::string& filter);
void set_string(const std::string& s) { string_ = s; }
diff --git a/ppapi/tests/test_memory.cc b/ppapi/tests/test_memory.cc
index 1dedbd4..4acbd5f 100644
--- a/ppapi/tests/test_memory.cc
+++ b/ppapi/tests/test_memory.cc
@@ -24,9 +24,9 @@ bool TestMemory::Init() {
return memory_dev_interface_ && InitTestingInterface();
}
-void TestMemory::RunTest() {
- RUN_TEST(MemAlloc);
- RUN_TEST(NullMemFree);
+void TestMemory::RunTests(const std::string& filter) {
+ RUN_TEST(MemAlloc, filter);
+ RUN_TEST(NullMemFree, filter);
}
std::string TestMemory::TestMemAlloc() {
diff --git a/ppapi/tests/test_memory.h b/ppapi/tests/test_memory.h
index 4215ba0..10c8d79 100644
--- a/ppapi/tests/test_memory.h
+++ b/ppapi/tests/test_memory.h
@@ -18,7 +18,7 @@ class TestMemory : public TestCase {
private:
// TestCase implementation.
virtual bool Init();
- virtual void RunTest();
+ virtual void RunTests(const std::string& filter);
std::string TestMemAlloc();
std::string TestNullMemFree();
diff --git a/ppapi/tests/test_paint_aggregator.cc b/ppapi/tests/test_paint_aggregator.cc
index be3f19c..77e2174 100644
--- a/ppapi/tests/test_paint_aggregator.cc
+++ b/ppapi/tests/test_paint_aggregator.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -13,27 +13,27 @@ bool TestPaintAggregator::Init() {
return true;
}
-void TestPaintAggregator::RunTest() {
- RUN_TEST(InitialState);
- RUN_TEST(SingleInvalidation);
- RUN_TEST(DoubleDisjointInvalidation);
- RUN_TEST(SingleScroll);
- RUN_TEST(DoubleOverlappingScroll);
- RUN_TEST(NegatingScroll);
- RUN_TEST(DiagonalScroll);
- RUN_TEST(ContainedPaintAfterScroll);
- RUN_TEST(ContainedPaintBeforeScroll);
- RUN_TEST(ContainedPaintsBeforeAndAfterScroll);
- RUN_TEST(LargeContainedPaintAfterScroll);
- RUN_TEST(LargeContainedPaintBeforeScroll);
- RUN_TEST(OverlappingPaintBeforeScroll);
- RUN_TEST(OverlappingPaintAfterScroll);
- RUN_TEST(DisjointPaintBeforeScroll);
- RUN_TEST(DisjointPaintAfterScroll);
- RUN_TEST(ContainedPaintTrimmedByScroll);
- RUN_TEST(ContainedPaintEliminatedByScroll);
- RUN_TEST(ContainedPaintAfterScrollTrimmedByScrollDamage);
- RUN_TEST(ContainedPaintAfterScrollEliminatedByScrollDamage);
+void TestPaintAggregator::RunTests(const std::string& filter) {
+ RUN_TEST(InitialState, filter);
+ RUN_TEST(SingleInvalidation, filter);
+ RUN_TEST(DoubleDisjointInvalidation, filter);
+ RUN_TEST(SingleScroll, filter);
+ RUN_TEST(DoubleOverlappingScroll, filter);
+ RUN_TEST(NegatingScroll, filter);
+ RUN_TEST(DiagonalScroll, filter);
+ RUN_TEST(ContainedPaintAfterScroll, filter);
+ RUN_TEST(ContainedPaintBeforeScroll, filter);
+ RUN_TEST(ContainedPaintsBeforeAndAfterScroll, filter);
+ RUN_TEST(LargeContainedPaintAfterScroll, filter);
+ RUN_TEST(LargeContainedPaintBeforeScroll, filter);
+ RUN_TEST(OverlappingPaintBeforeScroll, filter);
+ RUN_TEST(OverlappingPaintAfterScroll, filter);
+ RUN_TEST(DisjointPaintBeforeScroll, filter);
+ RUN_TEST(DisjointPaintAfterScroll, filter);
+ RUN_TEST(ContainedPaintTrimmedByScroll, filter);
+ RUN_TEST(ContainedPaintEliminatedByScroll, filter);
+ RUN_TEST(ContainedPaintAfterScrollTrimmedByScrollDamage, filter);
+ RUN_TEST(ContainedPaintAfterScrollEliminatedByScrollDamage, filter);
}
std::string TestPaintAggregator::TestInitialState() {
diff --git a/ppapi/tests/test_paint_aggregator.h b/ppapi/tests/test_paint_aggregator.h
index 8649ee2..9b83eec 100644
--- a/ppapi/tests/test_paint_aggregator.h
+++ b/ppapi/tests/test_paint_aggregator.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -13,7 +13,7 @@ class TestPaintAggregator : public TestCase {
// TestCase implementation.
virtual bool Init();
- virtual void RunTest();
+ virtual void RunTests(const std::string& filter);
private:
std::string TestInitialState();
diff --git a/ppapi/tests/test_post_message.cc b/ppapi/tests/test_post_message.cc
index 9d6e569..0f97b74 100644
--- a/ppapi/tests/test_post_message.cc
+++ b/ppapi/tests/test_post_message.cc
@@ -106,16 +106,16 @@ bool TestPostMessage::Init() {
return success;
}
-void TestPostMessage::RunTest() {
+void TestPostMessage::RunTests(const std::string& filter) {
// Note: SendInInit must be first, because it expects to receive a message
// that was sent in Init above.
- RUN_TEST(SendInInit);
- RUN_TEST(SendingData);
- RUN_TEST(MessageEvent);
- RUN_TEST(NoHandler);
- RUN_TEST(ExtraParam);
+ RUN_TEST(SendInInit, filter);
+ RUN_TEST(SendingData, filter);
+ RUN_TEST(MessageEvent, filter);
+ RUN_TEST(NoHandler, filter);
+ RUN_TEST(ExtraParam, filter);
if (testing_interface_->IsOutOfProcess())
- RUN_TEST(NonMainThread);
+ RUN_TEST(NonMainThread, filter);
}
void TestPostMessage::HandleMessage(const pp::Var& message_data) {
@@ -186,9 +186,13 @@ std::string TestPostMessage::TestSendInInit() {
}
std::string TestPostMessage::TestSendingData() {
+ // Clean up after previous tests. This also swallows the message sent by Init
+ // if we didn't run the 'SendInInit' test. All tests other than 'SendInInit'
+ // should start with these.
+ WaitForMessages();
+ ASSERT_TRUE(ClearListeners());
// Set up the JavaScript message event listener to echo the data part of the
// message event back to us.
- ASSERT_TRUE(ClearListeners());
ASSERT_TRUE(AddEchoingListener("message_event.data"));
// Test sending a message to JavaScript for each supported type. The JS sends
@@ -244,9 +248,10 @@ std::string TestPostMessage::TestMessageEvent() {
// Set up the JavaScript message event listener to pass us some values from
// the MessageEvent and make sure they match our expectations.
+ WaitForMessages();
+ ASSERT_TRUE(ClearListeners());
// Have the listener pass back the type of message_event and make sure it's
// "object".
- ASSERT_TRUE(ClearListeners());
ASSERT_TRUE(AddEchoingListener("typeof(message_event)"));
message_data_.clear();
instance_->PostMessage(pp::Var(kTestInt));
@@ -299,13 +304,12 @@ std::string TestPostMessage::TestMessageEvent() {
ASSERT_DOUBLE_EQ(double_vec[1], 2.0);
ASSERT_DOUBLE_EQ(double_vec[2], 3.0);
- ASSERT_TRUE(ClearListeners());
-
PASS();
}
std::string TestPostMessage::TestNoHandler() {
- // Delete any lingering event listeners.
+ // Delete any lingering messages and event listeners.
+ WaitForMessages();
ASSERT_TRUE(ClearListeners());
// Now send a message. We shouldn't get a response.
@@ -318,7 +322,8 @@ std::string TestPostMessage::TestNoHandler() {
}
std::string TestPostMessage::TestExtraParam() {
- // Delete any lingering event listeners.
+ // Delete any lingering messages and event listeners.
+ WaitForMessages();
ASSERT_TRUE(ClearListeners());
// Add a listener that will respond with 1 and an empty array (where the
// message port array would appear if it was Worker postMessage).
@@ -334,6 +339,7 @@ std::string TestPostMessage::TestExtraParam() {
}
std::string TestPostMessage::TestNonMainThread() {
+ WaitForMessages();
ASSERT_TRUE(ClearListeners());
ASSERT_TRUE(AddEchoingListener("message_event.data"));
message_data_.clear();
diff --git a/ppapi/tests/test_post_message.h b/ppapi/tests/test_post_message.h
index af1dc36..b8e6499 100644
--- a/ppapi/tests/test_post_message.h
+++ b/ppapi/tests/test_post_message.h
@@ -18,7 +18,7 @@ class TestPostMessage : public TestCase {
private:
// TestCase implementation.
virtual bool Init();
- virtual void RunTest();
+ virtual void RunTests(const std::string& filter);
// A handler for JS->Native calls to postMessage. Simply pushes
// the given value to the back of message_data_
diff --git a/ppapi/tests/test_scrollbar.cc b/ppapi/tests/test_scrollbar.cc
index 3b38dd8..61345d0 100644
--- a/ppapi/tests/test_scrollbar.cc
+++ b/ppapi/tests/test_scrollbar.cc
@@ -26,7 +26,7 @@ bool TestScrollbar::Init() {
return InitTestingInterface();
}
-void TestScrollbar::RunTest() {
+void TestScrollbar::RunTests(const std::string& filter) {
instance_->LogTest("HandleEvent", TestHandleEvent());
}
diff --git a/ppapi/tests/test_scrollbar.h b/ppapi/tests/test_scrollbar.h
index a83194d..4025fbb4 100644
--- a/ppapi/tests/test_scrollbar.h
+++ b/ppapi/tests/test_scrollbar.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -17,7 +17,7 @@ class TestScrollbar : public TestCase,
// TestCase implementation.
virtual bool Init();
- virtual void RunTest();
+ virtual void RunTests(const std::string& filter);
private:
std::string TestHandleEvent();
diff --git a/ppapi/tests/test_transport.cc b/ppapi/tests/test_transport.cc
index d2d2850..5826f35 100644
--- a/ppapi/tests/test_transport.cc
+++ b/ppapi/tests/test_transport.cc
@@ -102,14 +102,14 @@ bool TestTransport::Init() {
return transport_interface_ && InitTestingInterface();
}
-void TestTransport::RunTest() {
- RUN_TEST(Create);
- RUN_TEST_FORCEASYNC_AND_NOT(Connect);
- RUN_TEST(SetProperty);
- RUN_TEST_FORCEASYNC_AND_NOT(SendDataUdp);
- RUN_TEST_FORCEASYNC_AND_NOT(SendDataTcp);
- RUN_TEST_FORCEASYNC_AND_NOT(ConnectAndCloseUdp);
- RUN_TEST_FORCEASYNC_AND_NOT(ConnectAndCloseTcp);
+void TestTransport::RunTests(const std::string& filter) {
+ RUN_TEST(Create, filter);
+ RUN_TEST_FORCEASYNC_AND_NOT(Connect, filter);
+ RUN_TEST(SetProperty, filter);
+ RUN_TEST_FORCEASYNC_AND_NOT(SendDataUdp, filter);
+ RUN_TEST_FORCEASYNC_AND_NOT(SendDataTcp, filter);
+ RUN_TEST_FORCEASYNC_AND_NOT(ConnectAndCloseUdp, filter);
+ RUN_TEST_FORCEASYNC_AND_NOT(ConnectAndCloseTcp, filter);
}
std::string TestTransport::InitTargets(PP_TransportType type) {
diff --git a/ppapi/tests/test_transport.h b/ppapi/tests/test_transport.h
index b8f7426..7454232 100644
--- a/ppapi/tests/test_transport.h
+++ b/ppapi/tests/test_transport.h
@@ -23,7 +23,7 @@ class TestTransport : public TestCase {
// TestCase implementation.
virtual bool Init();
- virtual void RunTest();
+ virtual void RunTests(const std::string& filter);
private:
std::string InitTargets(PP_TransportType type);
diff --git a/ppapi/tests/test_uma.cc b/ppapi/tests/test_uma.cc
index a310e8f..a780282 100644
--- a/ppapi/tests/test_uma.cc
+++ b/ppapi/tests/test_uma.cc
@@ -17,7 +17,7 @@ bool TestUMA::Init() {
return !!uma_interface_;
}
-void TestUMA::RunTest() {
+void TestUMA::RunTests(const std::string& filter) {
instance_->LogTest("Count", TestCount());
instance_->LogTest("Time", TestTime());
instance_->LogTest("Enum", TestEnum());
diff --git a/ppapi/tests/test_uma.h b/ppapi/tests/test_uma.h
index 0a60fde..367f7c45 100644
--- a/ppapi/tests/test_uma.h
+++ b/ppapi/tests/test_uma.h
@@ -17,7 +17,7 @@ class TestUMA : public TestCase {
// TestCase implementation.
virtual bool Init();
- virtual void RunTest();
+ virtual void RunTests(const std::string& filter);
private:
std::string TestCount();
diff --git a/ppapi/tests/test_url_loader.cc b/ppapi/tests/test_url_loader.cc
index a17cef6..44f969c 100644
--- a/ppapi/tests/test_url_loader.cc
+++ b/ppapi/tests/test_url_loader.cc
@@ -77,27 +77,27 @@ bool TestURLLoader::Init() {
return InitTestingInterface() && EnsureRunningOverHTTP();
}
-void TestURLLoader::RunTest() {
- RUN_TEST_FORCEASYNC_AND_NOT(BasicGET);
- RUN_TEST_FORCEASYNC_AND_NOT(BasicPOST);
- RUN_TEST_FORCEASYNC_AND_NOT(BasicFilePOST);
- RUN_TEST_FORCEASYNC_AND_NOT(BasicFileRangePOST);
- RUN_TEST_FORCEASYNC_AND_NOT(CompoundBodyPOST);
- RUN_TEST_FORCEASYNC_AND_NOT(EmptyDataPOST);
- RUN_TEST_FORCEASYNC_AND_NOT(BinaryDataPOST);
- RUN_TEST_FORCEASYNC_AND_NOT(CustomRequestHeader);
- RUN_TEST_FORCEASYNC_AND_NOT(FailsBogusContentLength);
- RUN_TEST_FORCEASYNC_AND_NOT(SameOriginRestriction);
- RUN_TEST_FORCEASYNC_AND_NOT(CrossOriginRequest);
- RUN_TEST_FORCEASYNC_AND_NOT(JavascriptURLRestriction);
- RUN_TEST_FORCEASYNC_AND_NOT(MethodRestriction);
- RUN_TEST_FORCEASYNC_AND_NOT(HeaderRestriction);
- RUN_TEST_FORCEASYNC_AND_NOT(CustomReferrer);
- RUN_TEST_FORCEASYNC_AND_NOT(CustomContentTransferEncoding);
- RUN_TEST_FORCEASYNC_AND_NOT(StreamToFile);
- RUN_TEST_FORCEASYNC_AND_NOT(AuditURLRedirect);
- RUN_TEST_FORCEASYNC_AND_NOT(AbortCalls);
- RUN_TEST_FORCEASYNC_AND_NOT(UntendedLoad);
+void TestURLLoader::RunTests(const std::string& filter) {
+ RUN_TEST_FORCEASYNC_AND_NOT(BasicGET, filter);
+ RUN_TEST_FORCEASYNC_AND_NOT(BasicPOST, filter);
+ RUN_TEST_FORCEASYNC_AND_NOT(BasicFilePOST, filter);
+ RUN_TEST_FORCEASYNC_AND_NOT(BasicFileRangePOST, filter);
+ RUN_TEST_FORCEASYNC_AND_NOT(CompoundBodyPOST, filter);
+ RUN_TEST_FORCEASYNC_AND_NOT(EmptyDataPOST, filter);
+ RUN_TEST_FORCEASYNC_AND_NOT(BinaryDataPOST, filter);
+ RUN_TEST_FORCEASYNC_AND_NOT(CustomRequestHeader, filter);
+ RUN_TEST_FORCEASYNC_AND_NOT(FailsBogusContentLength, filter);
+ RUN_TEST_FORCEASYNC_AND_NOT(SameOriginRestriction, filter);
+ RUN_TEST_FORCEASYNC_AND_NOT(CrossOriginRequest, filter);
+ RUN_TEST_FORCEASYNC_AND_NOT(JavascriptURLRestriction, filter);
+ RUN_TEST_FORCEASYNC_AND_NOT(MethodRestriction, filter);
+ RUN_TEST_FORCEASYNC_AND_NOT(HeaderRestriction, filter);
+ RUN_TEST_FORCEASYNC_AND_NOT(CustomReferrer, filter);
+ RUN_TEST_FORCEASYNC_AND_NOT(CustomContentTransferEncoding, filter);
+ RUN_TEST_FORCEASYNC_AND_NOT(StreamToFile, filter);
+ RUN_TEST_FORCEASYNC_AND_NOT(AuditURLRedirect, filter);
+ RUN_TEST_FORCEASYNC_AND_NOT(AbortCalls, filter);
+ RUN_TEST_FORCEASYNC_AND_NOT(UntendedLoad, filter);
}
std::string TestURLLoader::ReadEntireFile(pp::FileIO* file_io,
diff --git a/ppapi/tests/test_url_loader.h b/ppapi/tests/test_url_loader.h
index 0939848..a31d09e 100644
--- a/ppapi/tests/test_url_loader.h
+++ b/ppapi/tests/test_url_loader.h
@@ -26,7 +26,7 @@ class TestURLLoader : public TestCase {
// TestCase implementation.
virtual bool Init();
- virtual void RunTest();
+ virtual void RunTests(const std::string& filter);
private:
std::string ReadEntireFile(pp::FileIO* file_io, std::string* data);
diff --git a/ppapi/tests/test_url_util.cc b/ppapi/tests/test_url_util.cc
index dc6cb47..179aeeb 100644
--- a/ppapi/tests/test_url_util.cc
+++ b/ppapi/tests/test_url_util.cc
@@ -20,14 +20,14 @@ bool TestURLUtil::Init() {
return !!util_;
}
-void TestURLUtil::RunTest() {
- RUN_TEST(Canonicalize);
- RUN_TEST(ResolveRelative);
- RUN_TEST(IsSameSecurityOrigin);
- RUN_TEST(DocumentCanRequest);
- RUN_TEST(DocumentCanAccessDocument);
- RUN_TEST(GetDocumentURL);
- RUN_TEST(GetPluginInstanceURL);
+void TestURLUtil::RunTests(const std::string& filter) {
+ RUN_TEST(Canonicalize, filter);
+ RUN_TEST(ResolveRelative, filter);
+ RUN_TEST(IsSameSecurityOrigin, filter);
+ RUN_TEST(DocumentCanRequest, filter);
+ RUN_TEST(DocumentCanAccessDocument, filter);
+ RUN_TEST(GetDocumentURL, filter);
+ RUN_TEST(GetPluginInstanceURL, filter);
}
std::string TestURLUtil::TestCanonicalize() {
diff --git a/ppapi/tests/test_url_util.h b/ppapi/tests/test_url_util.h
index 0bb1f3f..b701271 100644
--- a/ppapi/tests/test_url_util.h
+++ b/ppapi/tests/test_url_util.h
@@ -14,7 +14,7 @@ class TestURLUtil : public TestCase {
// TestCase implementation.
virtual bool Init();
- virtual void RunTest();
+ virtual void RunTests(const std::string& filter);
private:
std::string TestCanonicalize();
diff --git a/ppapi/tests/test_var.cc b/ppapi/tests/test_var.cc
index 9e91dc4..6357737 100644
--- a/ppapi/tests/test_var.cc
+++ b/ppapi/tests/test_var.cc
@@ -31,14 +31,14 @@ bool TestVar::Init() {
return var_interface_ && InitTestingInterface();
}
-void TestVar::RunTest() {
- RUN_TEST(BasicString);
- RUN_TEST(InvalidAndEmpty);
- RUN_TEST(InvalidUtf8);
- RUN_TEST(NullInputInUtf8Conversion);
- RUN_TEST(ValidUtf8);
- RUN_TEST(Utf8WithEmbeddedNulls);
- RUN_TEST(VarToUtf8ForWrongType);
+void TestVar::RunTests(const std::string& filter) {
+ RUN_TEST(BasicString, filter);
+ RUN_TEST(InvalidAndEmpty, filter);
+ RUN_TEST(InvalidUtf8, filter);
+ RUN_TEST(NullInputInUtf8Conversion, filter);
+ RUN_TEST(ValidUtf8, filter);
+ RUN_TEST(Utf8WithEmbeddedNulls, filter);
+ RUN_TEST(VarToUtf8ForWrongType, filter);
}
std::string TestVar::TestBasicString() {
diff --git a/ppapi/tests/test_var.h b/ppapi/tests/test_var.h
index 939e942..a329c780 100644
--- a/ppapi/tests/test_var.h
+++ b/ppapi/tests/test_var.h
@@ -19,7 +19,7 @@ class TestVar : public TestCase {
private:
// TestCase implementation.
virtual bool Init();
- virtual void RunTest();
+ virtual void RunTests(const std::string& filter);
std::string TestBasicString();
std::string TestInvalidAndEmpty();
diff --git a/ppapi/tests/test_var_deprecated.cc b/ppapi/tests/test_var_deprecated.cc
index 253058d..66ef23a 100644
--- a/ppapi/tests/test_var_deprecated.cc
+++ b/ppapi/tests/test_var_deprecated.cc
@@ -73,16 +73,16 @@ bool TestVarDeprecated::Init() {
return var_interface_ && InitTestingInterface();
}
-void TestVarDeprecated::RunTest() {
- RUN_TEST(BasicString);
- RUN_TEST(InvalidAndEmpty);
- RUN_TEST(InvalidUtf8);
- RUN_TEST(NullInputInUtf8Conversion);
- RUN_TEST(ValidUtf8);
- RUN_TEST(Utf8WithEmbeddedNulls);
- RUN_TEST(VarToUtf8ForWrongType);
- RUN_TEST(HasPropertyAndMethod);
- RUN_TEST(PassReference);
+void TestVarDeprecated::RunTests(const std::string& filter) {
+ RUN_TEST(BasicString, filter);
+ RUN_TEST(InvalidAndEmpty, filter);
+ RUN_TEST(InvalidUtf8, filter);
+ RUN_TEST(NullInputInUtf8Conversion, filter);
+ RUN_TEST(ValidUtf8, filter);
+ RUN_TEST(Utf8WithEmbeddedNulls, filter);
+ RUN_TEST(VarToUtf8ForWrongType, filter);
+ RUN_TEST(HasPropertyAndMethod, filter);
+ RUN_TEST(PassReference, filter);
}
pp::deprecated::ScriptableObject* TestVarDeprecated::CreateTestObject() {
diff --git a/ppapi/tests/test_var_deprecated.h b/ppapi/tests/test_var_deprecated.h
index 8e64ece..d8b86b8 100644
--- a/ppapi/tests/test_var_deprecated.h
+++ b/ppapi/tests/test_var_deprecated.h
@@ -18,7 +18,7 @@ class TestVarDeprecated : public TestCase {
// TestCase implementation.
virtual bool Init();
- virtual void RunTest();
+ virtual void RunTests(const std::string& filter);
void set_var_from_page(const pp::VarPrivate& v) { var_from_page_ = v; }
diff --git a/ppapi/tests/test_video_decoder.cc b/ppapi/tests/test_video_decoder.cc
index 0be8d95..faaa772 100644
--- a/ppapi/tests/test_video_decoder.cc
+++ b/ppapi/tests/test_video_decoder.cc
@@ -18,8 +18,8 @@ bool TestVideoDecoder::Init() {
return video_decoder_interface_ && InitTestingInterface();
}
-void TestVideoDecoder::RunTest() {
- RUN_TEST(CreateFailure);
+void TestVideoDecoder::RunTests(const std::string& filter) {
+ RUN_TEST(CreateFailure, filter);
}
void TestVideoDecoder::QuitMessageLoop() {
diff --git a/ppapi/tests/test_video_decoder.h b/ppapi/tests/test_video_decoder.h
index 7409b4e..b20d6de 100644
--- a/ppapi/tests/test_video_decoder.h
+++ b/ppapi/tests/test_video_decoder.h
@@ -17,7 +17,7 @@ class TestVideoDecoder : public TestCase {
// TestCase implementation.
virtual bool Init();
- virtual void RunTest();
+ virtual void RunTests(const std::string& filter);
void QuitMessageLoop();
diff --git a/ppapi/tests/testing_instance.cc b/ppapi/tests/testing_instance.cc
index e50bb5a3..056477d 100644
--- a/ppapi/tests/testing_instance.cc
+++ b/ppapi/tests/testing_instance.cc
@@ -56,6 +56,7 @@ bool TestingInstance::Init(uint32_t argc,
if (argv[i][0] == '\0')
break;
current_case_ = CaseForTestName(argv[i]);
+ test_filter_ = FilterForTestName(argv[i]);
if (!current_case_)
errors_.append(std::string("Unknown test case ") + argv[i]);
else if (!current_case_->Init())
@@ -144,7 +145,7 @@ void TestingInstance::ExecuteTests(int32_t unused) {
LogAvailableTests();
errors_.append("FAIL: Only listed tests");
} else {
- current_case_->RunTest();
+ current_case_->RunTests(test_filter_);
// Automated PyAuto tests rely on finding the exact strings below.
LogHTML(errors_.empty() ?
"<span class=\"pass\">[SHUTDOWN]</span> All tests passed." :
@@ -156,16 +157,24 @@ void TestingInstance::ExecuteTests(int32_t unused) {
PostMessage(pp::Var("TESTING_MESSAGE:DidExecuteTests"));
}
-TestCase* TestingInstance::CaseForTestName(const char* name) {
+TestCase* TestingInstance::CaseForTestName(const std::string& name) {
+ std::string case_name = name.substr(0, name.find_first_of('_'));
TestCaseFactory* iter = TestCaseFactory::head_;
while (iter != NULL) {
- if (std::strcmp(name, iter->name_) == 0)
+ if (case_name == iter->name_)
return iter->method_(this);
iter = iter->next_;
}
return NULL;
}
+std::string TestingInstance::FilterForTestName(const std::string& name) {
+ size_t delim = name.find_first_of('_');
+ if (delim != std::string::npos)
+ return name.substr(delim+1);
+ return "";
+}
+
void TestingInstance::LogAvailableTests() {
// Print out a listing of all tests.
std::vector<std::string> test_cases;
diff --git a/ppapi/tests/testing_instance.h b/ppapi/tests/testing_instance.h
index 0c79923..8f6b7b1 100644
--- a/ppapi/tests/testing_instance.h
+++ b/ppapi/tests/testing_instance.h
@@ -87,8 +87,18 @@ pp::InstancePrivate {
void ExecuteTests(int32_t unused);
// Creates a new TestCase for the give test name, or NULL if there is no such
- // test. Ownership is passed to the caller.
- TestCase* CaseForTestName(const char* name);
+ // test. Ownership is passed to the caller. The given string is split by '_'.
+ // The test case name is the first part.
+ TestCase* CaseForTestName(const std::string& name);
+ // Returns the filter (second part) of the given string. If there is no '_',
+ // returns the empty string, which means 'run all tests for this test case'.
+ // E.g.:
+ // http://testserver/test_case.html?testcase=PostMessage
+ // Otherwise, the part of the testcase after '_' is returned, and the test
+ // whose name matches that string (if any) will be run:
+ // http://testserver/test_case.html?testcase=PostMessage_SendingData
+ // Runs 'PostMessage_SendingData.
+ std::string FilterForTestName(const std::string& name);
// Appends a list of available tests to the console in the document.
void LogAvailableTests();
@@ -109,6 +119,10 @@ pp::InstancePrivate {
// Owning pointer to the current test case. Valid after Init has been called.
TestCase* current_case_;
+ // A filter to use when running tests. This is passed to 'RunTests', which
+ // runs only tests whose name contains test_filter_ as a substring.
+ std::string test_filter_;
+
// The current step we're on starting at 0. This is incremented every time we
// report progress via a cookie. See comment above the class.
int progress_cookie_number_;