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> | |
9 #include <string> | 8 #include <string> |
10 | 9 |
11 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
12 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
13 #include "chrome/test/base/in_process_browser_test.h" | 12 #include "chrome/test/base/in_process_browser_test.h" |
14 #include "chrome/test/base/javascript_test_observer.h" | 13 #include "chrome/test/base/javascript_test_observer.h" |
15 #include "net/test/spawned_test_server/spawned_test_server.h" | 14 #include "net/test/spawned_test_server/spawned_test_server.h" |
16 | 15 |
17 namespace content { | 16 namespace content { |
18 class RenderViewHost; | 17 class RenderViewHost; |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 void RunTestViaHTTP(const std::string& test_case); | 55 void RunTestViaHTTP(const std::string& test_case); |
57 void RunTestWithSSLServer(const std::string& test_case); | 56 void RunTestWithSSLServer(const std::string& test_case); |
58 void RunTestWithWebSocketServer(const std::string& test_case); | 57 void RunTestWithWebSocketServer(const std::string& test_case); |
59 void RunTestIfAudioOutputAvailable(const std::string& test_case); | 58 void RunTestIfAudioOutputAvailable(const std::string& test_case); |
60 void RunTestViaHTTPIfAudioOutputAvailable(const std::string& test_case); | 59 void RunTestViaHTTPIfAudioOutputAvailable(const std::string& test_case); |
61 std::string StripPrefixes(const std::string& test_name); | 60 std::string StripPrefixes(const std::string& test_name); |
62 | 61 |
63 protected: | 62 protected: |
64 class InfoBarObserver : public content::NotificationObserver { | 63 class InfoBarObserver : public content::NotificationObserver { |
65 public: | 64 public: |
66 InfoBarObserver(); | 65 explicit InfoBarObserver(PPAPITestBase* test_base); |
67 ~InfoBarObserver(); | 66 ~InfoBarObserver(); |
68 | 67 |
| 68 void ExpectInfoBarAndAccept(bool should_accept); |
| 69 |
| 70 private: |
| 71 // content::NotificationObserver: |
69 virtual void Observe(int type, | 72 virtual void Observe(int type, |
70 const content::NotificationSource& source, | 73 const content::NotificationSource& source, |
71 const content::NotificationDetails& details) OVERRIDE; | 74 const content::NotificationDetails& details) OVERRIDE; |
72 | 75 |
73 void ExpectInfoBarAndAccept(bool should_accept); | 76 void VerifyInfoBarState(); |
74 | 77 |
75 private: | |
76 content::NotificationRegistrar registrar_; | 78 content::NotificationRegistrar registrar_; |
77 std::list<bool> expected_infobars_; | 79 PPAPITestBase* test_base_; |
| 80 bool expecting_infobar_; |
| 81 bool should_accept_; |
78 }; | 82 }; |
79 | 83 |
80 // Runs the test for a tab given the tab that's already navigated to the | 84 // Runs the test for a tab given the tab that's already navigated to the |
81 // given URL. | 85 // given URL. |
82 void RunTestURL(const GURL& test_url); | 86 void RunTestURL(const GURL& test_url); |
83 // Gets the URL of the the given |test_case| for the given HTTP test server. | 87 // Gets the URL of the the given |test_case| for the given HTTP test server. |
84 // If |extra_params| is non-empty, it will be appended as URL parameters. | 88 // If |extra_params| is non-empty, it will be appended as URL parameters. |
85 GURL GetTestURL(const net::SpawnedTestServer& http_server, | 89 GURL GetTestURL(const net::SpawnedTestServer& http_server, |
86 const std::string& test_case, | 90 const std::string& test_case, |
87 const std::string& extra_params); | 91 const std::string& extra_params); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 const std::string& test_case) OVERRIDE; | 153 const std::string& test_case) OVERRIDE; |
150 }; | 154 }; |
151 | 155 |
152 class PPAPIBrokerInfoBarTest : public OutOfProcessPPAPITest { | 156 class PPAPIBrokerInfoBarTest : public OutOfProcessPPAPITest { |
153 public: | 157 public: |
154 // PPAPITestBase override: | 158 // PPAPITestBase override: |
155 virtual void SetUpOnMainThread() OVERRIDE; | 159 virtual void SetUpOnMainThread() OVERRIDE; |
156 }; | 160 }; |
157 | 161 |
158 #endif // CHROME_TEST_PPAPI_PPAPI_TEST_H_ | 162 #endif // CHROME_TEST_PPAPI_PPAPI_TEST_H_ |
OLD | NEW |