summaryrefslogtreecommitdiffstats
path: root/chrome/test/nacl/nacl_test.h
blob: 06b371b2efc2f5ed51e00b30e9589beeb2e33aaf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// Copyright (c) 2009 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.

#ifndef CHROME_TEST_NACL_NACL_TEST_H_
#define CHROME_TEST_NACL_NACL_TEST_H_

#include "chrome/test/ui/ui_test.h"

class FilePath;

// This class implements integration tests for Native Client.
// For security reasons, Native Client currently loads modules from port 5103
// only, therefore running the test currently requires starting
// a local webserver on this port.
// This limitation will be removed in the future.
// Additional functionality used in this test is implemented in html and JS
// files that are part of NaCl tree.
class NaClTest : public UITest {
 protected:
  NaClTest();
  virtual ~NaClTest();

  // Get the path to the native_client/tests directory, the root of testing
  // data.
  FilePath GetTestRootDir();

  // 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);

  // 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);

 private:
  void PrepareSrpcHwTest(FilePath test_root_dir);
  void PrepareServerTest(FilePath test_root_dir);
  void PrepareSrpcBasicTest(FilePath test_root_dir);
  void PrepareSrpcSockAddrTest(FilePath test_root_dir);
  void PrepareSrpcShmTest(FilePath test_root_dir);
  void PrepareSrpcPluginTest(FilePath test_root_dir);
  void PrepareSrpcNrdXferTest(FilePath test_root_dir);
  void PrepareNpapiHwTest(FilePath test_root_dir);

  // Compute the path to the test binaries (prebuilt NaCL executables).
  FilePath GetTestBinariesDir();
};

#endif  // CHROME_TEST_NACL_NACL_TEST_H_