summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-09 19:05:02 +0000
committerevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-09 19:05:02 +0000
commitc1786301d064a8f1d26fab2393e176d9f3464822 (patch)
tree4c767c6d11fb8571a57f76f69beff50c0d7bbe87
parent9aaa3227b1f1a98146facdcbed5dbdba28a93f1c (diff)
downloadchromium_src-c1786301d064a8f1d26fab2393e176d9f3464822.zip
chromium_src-c1786301d064a8f1d26fab2393e176d9f3464822.tar.gz
chromium_src-c1786301d064a8f1d26fab2393e176d9f3464822.tar.bz2
nacl: add some comments to nacl_ui_tests
Just some basic observations I picked up while reading the code. TEST=compiles, should have no functional change Review URL: http://codereview.chromium.org/729003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@41059 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/test/nacl/nacl_test.cc36
-rw-r--r--chrome/test/nacl/nacl_test.h22
2 files changed, 37 insertions, 21 deletions
diff --git a/chrome/test/nacl/nacl_test.cc b/chrome/test/nacl/nacl_test.cc
index 4a47173..aa3293e 100644
--- a/chrome/test/nacl/nacl_test.cc
+++ b/chrome/test/nacl/nacl_test.cc
@@ -11,44 +11,47 @@
#include "net/base/escape.h"
#include "net/base/net_util.h"
-static const int kNaClTestTimeout = 20000;
+namespace {
+
+const int kNaClTestTimeout = 20000;
const char kTestCompleteCookie[] = "status";
const char kTestCompleteSuccess[] = "OK";
-static const FilePath::CharType kBaseUrl[] =
+const FilePath::CharType kBaseUrl[] =
FILE_PATH_LITERAL("http://localhost:5103/");
-static const FilePath::CharType kSrpcHwHtmlFileName[] =
+const FilePath::CharType kSrpcHwHtmlFileName[] =
FILE_PATH_LITERAL("srpc_hw.html");
-static const FilePath::CharType kSrpcHwNexeFileName[] =
+const FilePath::CharType kSrpcHwNexeFileName[] =
FILE_PATH_LITERAL("srpc_hw.nexe");
-static const FilePath::CharType kSrpcBasicHtmlFileName[] =
+const FilePath::CharType kSrpcBasicHtmlFileName[] =
FILE_PATH_LITERAL("srpc_basic.html");
-static const FilePath::CharType kSrpcBasicNexeFileName[] =
+const FilePath::CharType kSrpcBasicNexeFileName[] =
FILE_PATH_LITERAL("srpc_test.nexe");
-static const FilePath::CharType kSrpcSockAddrHtmlFileName[] =
+const FilePath::CharType kSrpcSockAddrHtmlFileName[] =
FILE_PATH_LITERAL("srpc_sockaddr.html");
-static const FilePath::CharType kSrpcShmHtmlFileName[] =
+const FilePath::CharType kSrpcShmHtmlFileName[] =
FILE_PATH_LITERAL("srpc_shm.html");
-static const FilePath::CharType kSrpcShmNexeFileName[] =
+const FilePath::CharType kSrpcShmNexeFileName[] =
FILE_PATH_LITERAL("srpc_shm.nexe");
-static const FilePath::CharType kSrpcPluginHtmlFileName[] =
+const FilePath::CharType kSrpcPluginHtmlFileName[] =
FILE_PATH_LITERAL("srpc_plugin.html");
-static const FilePath::CharType kSrpcNrdXferHtmlFileName[] =
+const FilePath::CharType kSrpcNrdXferHtmlFileName[] =
FILE_PATH_LITERAL("srpc_nrd_xfer.html");
-static const FilePath::CharType kSrpcNrdClientNexeFileName[] =
+const FilePath::CharType kSrpcNrdClientNexeFileName[] =
FILE_PATH_LITERAL("srpc_nrd_client.nexe");
-static const FilePath::CharType kSrpcNrdServerNexeFileName[] =
+const FilePath::CharType kSrpcNrdServerNexeFileName[] =
FILE_PATH_LITERAL("srpc_nrd_server.nexe");
-static const FilePath::CharType kServerHtmlFileName[] =
+const FilePath::CharType kServerHtmlFileName[] =
FILE_PATH_LITERAL("server_test.html");
+} // anonymous namespace
NaClTest::NaClTest()
: UITest() {
@@ -75,7 +78,7 @@ FilePath NaClTest::GetTestBinariesDir() {
return path;
}
-// Static
+// static
GURL NaClTest::GetTestUrl(const FilePath& filename) {
FilePath path(kBaseUrl);
path = path.Append(filename);
@@ -83,9 +86,8 @@ GURL NaClTest::GetTestUrl(const FilePath& filename) {
}
-// Waits for the test case to finish.
void NaClTest::WaitForFinish(const FilePath& filename,
- const int wait_time) {
+ int wait_time) {
GURL url = GetTestUrl(filename);
scoped_refptr<TabProxy> tab(GetActiveTab());
ASSERT_TRUE(tab.get());
diff --git a/chrome/test/nacl/nacl_test.h b/chrome/test/nacl/nacl_test.h
index e3dacc8..b299e3f 100644
--- a/chrome/test/nacl/nacl_test.h
+++ b/chrome/test/nacl/nacl_test.h
@@ -21,14 +21,27 @@ class NaClTest : public UITest {
NaClTest();
virtual ~NaClTest();
+ // Get the path to the native_client/tests directory, the root of testing
+ // data.
FilePath GetTestRootDir();
- // Waits for the test case to finish.
- void WaitForFinish(const FilePath& filename, const int wait_time);
+
+ // Waits for a test case (identified by path) to finish.
+ void WaitForFinish(const FilePath& filename, int wait_time);
+
+ // Navigate the browser to a given test path, and wait for the test to
+ // complete.
void RunTest(const FilePath& filename, int timeout);
- void SetUp();
- void TearDown();
+
+ // gtest test setup overrides.
+ virtual void SetUp();
+ virtual void TearDown();
+
+ // Construct a URL for a test file on our local webserver.
GURL GetTestUrl(const FilePath& filename);
+
+ // Get the timeout used for NaCL tests.
int NaClTestTimeout();
+
private:
void PrepareSrpcHwTest(FilePath test_root_dir);
void PrepareServerTest(FilePath test_root_dir);
@@ -38,6 +51,7 @@ class NaClTest : public UITest {
void PrepareSrpcPluginTest(FilePath test_root_dir);
void PrepareSrpcNrdXferTest(FilePath test_root_dir);
+ // Compute the path to the test binaries (prebuilt NaCL executables).
FilePath GetTestBinariesDir();
};