OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #include "base/file_util.h" | 5 #include "base/file_util.h" |
6 #include "base/path_service.h" | 6 #include "base/path_service.h" |
| 7 #include "base/test/test_timeouts.h" |
7 #include "build/build_config.h" | 8 #include "build/build_config.h" |
8 #include "chrome/common/chrome_switches.h" | 9 #include "chrome/common/chrome_switches.h" |
9 #include "chrome/test/automation/tab_proxy.h" | 10 #include "chrome/test/automation/tab_proxy.h" |
10 #include "chrome/test/ui/ui_test.h" | 11 #include "chrome/test/ui/ui_test.h" |
11 #include "net/base/net_util.h" | 12 #include "net/base/net_util.h" |
12 #include "net/test/test_server.h" | 13 #include "net/test/test_server.h" |
13 #include "webkit/glue/plugins/plugin_switches.h" | 14 #include "webkit/glue/plugins/plugin_switches.h" |
14 | 15 |
15 namespace { | 16 namespace { |
16 | 17 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 FilePath(FILE_PATH_LITERAL("ppapi/tests"))); | 78 FilePath(FILE_PATH_LITERAL("ppapi/tests"))); |
78 ASSERT_TRUE(test_server.Start()); | 79 ASSERT_TRUE(test_server.Start()); |
79 RunTestURL(test_server.GetURL("files/test_case.html?" + test_case)); | 80 RunTestURL(test_server.GetURL("files/test_case.html?" + test_case)); |
80 } | 81 } |
81 | 82 |
82 private: | 83 private: |
83 void RunTestURL(const GURL& test_url) { | 84 void RunTestURL(const GURL& test_url) { |
84 scoped_refptr<TabProxy> tab(GetActiveTab()); | 85 scoped_refptr<TabProxy> tab(GetActiveTab()); |
85 ASSERT_TRUE(tab.get()); | 86 ASSERT_TRUE(tab.get()); |
86 ASSERT_TRUE(tab->NavigateToURL(test_url)); | 87 ASSERT_TRUE(tab->NavigateToURL(test_url)); |
| 88 |
| 89 // First wait for the "starting" signal. This cookie is set at the start |
| 90 // of every test. Waiting for this separately allows us to avoid a single |
| 91 // long timeout. Instead, we can have two timeouts which allow startup + |
| 92 // test execution time to take a while on a loaded computer, while also |
| 93 // making sure we're making forward progress. |
| 94 std::string startup_cookie = |
| 95 WaitUntilCookieNonEmpty(tab.get(), test_url, |
| 96 "STARTUP_COOKIE", action_max_timeout_ms()); |
| 97 |
| 98 // If this fails, the plugin couldn't be loaded in the given amount of |
| 99 // time. This may mean the plugin was not found or possibly the system |
| 100 // can't load it due to missing symbols, etc. |
| 101 ASSERT_STREQ("STARTED", startup_cookie.c_str()) |
| 102 << "Plugin couldn't be loaded. Make sure the PPAPI test plugin is " |
| 103 << "built, in the right place, and doesn't have any missing symbols."; |
| 104 |
87 std::string escaped_value = | 105 std::string escaped_value = |
88 WaitUntilCookieNonEmpty(tab.get(), test_url, | 106 WaitUntilCookieNonEmpty(tab.get(), test_url, |
89 "COMPLETION_COOKIE", action_max_timeout_ms()); | 107 "COMPLETION_COOKIE", TestTimeouts::large_test_timeout_ms()); |
90 EXPECT_STREQ("PASS", escaped_value.c_str()); | 108 EXPECT_STREQ("PASS", escaped_value.c_str()); |
91 } | 109 } |
92 }; | 110 }; |
93 | 111 |
94 TEST_F(PPAPITest, FAILS_Instance) { | 112 TEST_F(PPAPITest, FAILS_Instance) { |
95 RunTest("Instance"); | 113 RunTest("Instance"); |
96 } | 114 } |
97 | 115 |
98 TEST_F(PPAPITest, Graphics2D) { | 116 TEST_F(PPAPITest, Graphics2D) { |
99 RunTest("Graphics2D"); | 117 RunTest("Graphics2D"); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 | 161 |
144 // TODO(dumi): figure out why this test is flaky / crashing. | 162 // TODO(dumi): figure out why this test is flaky / crashing. |
145 TEST_F(PPAPITest, DISABLED_FileRef) { | 163 TEST_F(PPAPITest, DISABLED_FileRef) { |
146 RunTestViaHTTP("FileRef"); | 164 RunTestViaHTTP("FileRef"); |
147 } | 165 } |
148 | 166 |
149 // http://crbug.com/63239 | 167 // http://crbug.com/63239 |
150 TEST_F(PPAPITest, DISABLED_DirectoryReader) { | 168 TEST_F(PPAPITest, DISABLED_DirectoryReader) { |
151 RunTestViaHTTP("DirectoryReader"); | 169 RunTestViaHTTP("DirectoryReader"); |
152 } | 170 } |
OLD | NEW |