OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_TEST_PPAPI_PPAPI_TEST_H_ | 5 #ifndef CHROME_TEST_PPAPI_PPAPI_TEST_H_ |
6 #define CHROME_TEST_PPAPI_PPAPI_TEST_H_ | 6 #define CHROME_TEST_PPAPI_PPAPI_TEST_H_ |
7 | 7 |
| 8 #include <list> |
8 #include <string> | 9 #include <string> |
9 | 10 |
10 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
11 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
12 #include "chrome/test/base/in_process_browser_test.h" | 13 #include "chrome/test/base/in_process_browser_test.h" |
13 #include "chrome/test/base/javascript_test_observer.h" | 14 #include "chrome/test/base/javascript_test_observer.h" |
14 | 15 |
15 namespace content { | 16 namespace content { |
16 class RenderViewHost; | 17 class RenderViewHost; |
17 } | 18 } |
(...skipping 13 matching lines...) Expand all Loading... |
31 private: | 32 private: |
32 std::string message_; | 33 std::string message_; |
33 | 34 |
34 DISALLOW_COPY_AND_ASSIGN(PPAPITestMessageHandler); | 35 DISALLOW_COPY_AND_ASSIGN(PPAPITestMessageHandler); |
35 }; | 36 }; |
36 | 37 |
37 class PPAPITestBase : public InProcessBrowserTest { | 38 class PPAPITestBase : public InProcessBrowserTest { |
38 public: | 39 public: |
39 PPAPITestBase(); | 40 PPAPITestBase(); |
40 | 41 |
| 42 // InProcessBrowserTest: |
41 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE; | 43 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE; |
| 44 virtual void SetUpOnMainThread() OVERRIDE; |
42 | 45 |
43 virtual std::string BuildQuery(const std::string& base, | 46 virtual std::string BuildQuery(const std::string& base, |
44 const std::string& test_case) = 0; | 47 const std::string& test_case) = 0; |
45 | 48 |
46 // Returns the URL to load for file: tests. | 49 // Returns the URL to load for file: tests. |
47 GURL GetTestFileUrl(const std::string& test_case); | 50 GURL GetTestFileUrl(const std::string& test_case); |
48 void RunTest(const std::string& test_case); | 51 void RunTest(const std::string& test_case); |
49 // Run the test and reload. This can test for clean shutdown, including leaked | 52 // Run the test and reload. This can test for clean shutdown, including leaked |
50 // instance object vars. | 53 // instance object vars. |
51 void RunTestAndReload(const std::string& test_case); | 54 void RunTestAndReload(const std::string& test_case); |
52 void RunTestViaHTTP(const std::string& test_case); | 55 void RunTestViaHTTP(const std::string& test_case); |
53 void RunTestWithSSLServer(const std::string& test_case); | 56 void RunTestWithSSLServer(const std::string& test_case); |
54 void RunTestWithWebSocketServer(const std::string& test_case); | 57 void RunTestWithWebSocketServer(const std::string& test_case); |
55 void RunTestIfAudioOutputAvailable(const std::string& test_case); | 58 void RunTestIfAudioOutputAvailable(const std::string& test_case); |
56 void RunTestViaHTTPIfAudioOutputAvailable(const std::string& test_case); | 59 void RunTestViaHTTPIfAudioOutputAvailable(const std::string& test_case); |
57 std::string StripPrefixes(const std::string& test_name); | 60 std::string StripPrefixes(const std::string& test_name); |
58 | 61 |
59 protected: | 62 protected: |
| 63 class InfoBarObserver : public content::NotificationObserver { |
| 64 public: |
| 65 InfoBarObserver(); |
| 66 ~InfoBarObserver(); |
| 67 |
| 68 virtual void Observe(int type, |
| 69 const content::NotificationSource& source, |
| 70 const content::NotificationDetails& details) OVERRIDE; |
| 71 |
| 72 void ExpectInfoBarAndAccept(bool should_accept); |
| 73 |
| 74 private: |
| 75 content::NotificationRegistrar registrar_; |
| 76 std::list<bool> expected_infobars_; |
| 77 }; |
| 78 |
60 // Runs the test for a tab given the tab that's already navigated to the | 79 // Runs the test for a tab given the tab that's already navigated to the |
61 // given URL. | 80 // given URL. |
62 void RunTestURL(const GURL& test_url); | 81 void RunTestURL(const GURL& test_url); |
63 // Run the given |test_case| on a HTTP test server whose document root is | 82 // Run the given |test_case| on a HTTP test server whose document root is |
64 // specified by |document_root|. |extra_params| will be passed as URL | 83 // specified by |document_root|. |extra_params| will be passed as URL |
65 // parameters to the test. | 84 // parameters to the test. |
66 void RunHTTPTestServer(const FilePath& document_root, | 85 void RunHTTPTestServer(const FilePath& document_root, |
67 const std::string& test_case, | 86 const std::string& test_case, |
68 const std::string& extra_params); | 87 const std::string& extra_params); |
69 // Return the document root for the HTTP server on which tests will be run. | 88 // Return the document root for the HTTP server on which tests will be run. |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 }; | 132 }; |
114 | 133 |
115 class PPAPINaClTestDisallowedSockets : public PPAPITestBase { | 134 class PPAPINaClTestDisallowedSockets : public PPAPITestBase { |
116 public: | 135 public: |
117 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE; | 136 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE; |
118 | 137 |
119 virtual std::string BuildQuery(const std::string& base, | 138 virtual std::string BuildQuery(const std::string& base, |
120 const std::string& test_case) OVERRIDE; | 139 const std::string& test_case) OVERRIDE; |
121 }; | 140 }; |
122 | 141 |
| 142 class PPAPIBrokerInfoBarTest : public PPAPITest { |
| 143 public: |
| 144 // PPAPITestBase override: |
| 145 virtual void SetUpOnMainThread() OVERRIDE; |
| 146 }; |
| 147 |
123 #endif // CHROME_TEST_PPAPI_PPAPI_TEST_H_ | 148 #endif // CHROME_TEST_PPAPI_PPAPI_TEST_H_ |
OLD | NEW |