Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(364)

Side by Side Diff: chrome/test/ui/ppapi_uitest.cc

Issue 7677031: Try to reduce the flankness of the PPAPI UI tests. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | ppapi/tests/testing_instance.h » ('j') | ppapi/tests/testing_instance.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "base/test/test_timeouts.h"
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 #include "chrome/common/chrome_switches.h" 9 #include "chrome/common/chrome_switches.h"
10 #include "chrome/test/automation/tab_proxy.h" 10 #include "chrome/test/automation/tab_proxy.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 RunTestURL( 83 RunTestURL(
84 test_server.GetURL("files/test_case.html?testcase=" + test_case)); 84 test_server.GetURL("files/test_case.html?testcase=" + test_case));
85 } 85 }
86 86
87 private: 87 private:
88 void RunTestURL(const GURL& test_url) { 88 void RunTestURL(const GURL& test_url) {
89 scoped_refptr<TabProxy> tab(GetActiveTab()); 89 scoped_refptr<TabProxy> tab(GetActiveTab());
90 ASSERT_TRUE(tab.get()); 90 ASSERT_TRUE(tab.get());
91 ASSERT_TRUE(tab->NavigateToURL(test_url)); 91 ASSERT_TRUE(tab->NavigateToURL(test_url));
92 92
93 // First wait for the "starting" signal. This cookie is set at the start 93 // See comment above TestingInstance in the ppapi test plugin. Basically
polina 2011/08/22 23:53:58 a file path would be useful here
94 // of every test. Waiting for this separately allows us to avoid a single 94 // it sets a series of numbered cookies. The value of "..." means it's
95 // long timeout. Instead, we can have two timeouts which allow startup + 95 // still working and we should continue to wait, any other value indicates
96 // test execution time to take a while on a loaded computer, while also 96 // completion (in this case it will start with "PASS" or "FAIL". This
97 // making sure we're making forward progress. 97 // keeps us from timing out on cookie waits for long tests.
polina 2011/08/22 23:53:58 missing closing ")"
98 std::string startup_cookie = 98 int progress_number = 0;
99 WaitUntilCookieNonEmpty(tab.get(), test_url, 99 std::string progress;
100 "STARTUP_COOKIE", TestTimeouts::action_max_timeout_ms()); 100 while (true) {
Paweł Hajdan Jr. 2011/08/18 22:45:13 NOOOOOOO! If you need a loop, you're doing it wron
Paweł Hajdan Jr. 2011/08/18 22:47:20 Ooops, please ignore my earlier comment. It's not
101 std::string cookie_name = StringPrintf("PPAPI_PROGRESS_%d",
polina 2011/08/22 23:53:58 Is it not an option to share "PPAPI_PROGRESS", "..
brettw 2011/08/24 16:42:17 Unfortunately, there's no code in common between t
102 progress_number);
103 progress = WaitUntilCookieNonEmpty(tab.get(), test_url,
104 cookie_name.c_str(), TestTimeouts::large_test_timeout_ms());
105 if (progress != "...")
106 break;
107 progress_number++;
108 }
101 109
102 // If this fails, the plugin couldn't be loaded in the given amount of 110 if (progress_number == 0) {
103 // time. This may mean the plugin was not found or possibly the system 111 // Failing the first time probably means the plugin wasn't loaded.
104 // can't load it due to missing symbols, etc. 112 ASSERT_FALSE(progress.empty())
105 ASSERT_STREQ("STARTED", startup_cookie.c_str()) 113 << "Plugin couldn't be loaded. Make sure the PPAPI test plugin is "
106 << "Plugin couldn't be loaded. Make sure the PPAPI test plugin is " 114 << "built, in the right place, and doesn't have any missing symbols.";
107 << "built, in the right place, and doesn't have any missing symbols."; 115 } else {
116 ASSERT_FALSE(progress.empty()) << "Test timed out.";
117 }
108 118
109 std::string escaped_value = 119 EXPECT_STREQ("PASS", progress.c_str());
110 WaitUntilCookieNonEmpty(tab.get(), test_url,
111 "COMPLETION_COOKIE", TestTimeouts::large_test_timeout_ms());
112 EXPECT_STREQ("PASS", escaped_value.c_str());
113 } 120 }
114 }; 121 };
115 122
116 // Variant of PPAPITest that runs plugins out-of-process to test proxy 123 // Variant of PPAPITest that runs plugins out-of-process to test proxy
117 // codepaths. 124 // codepaths.
118 class OutOfProcessPPAPITest : public PPAPITest { 125 class OutOfProcessPPAPITest : public PPAPITest {
119 public: 126 public:
120 OutOfProcessPPAPITest() { 127 OutOfProcessPPAPITest() {
121 // Run PPAPI out-of-process to exercise proxy implementations. 128 // Run PPAPI out-of-process to exercise proxy implementations.
122 launch_arguments_.AppendSwitch(switches::kPpapiOutOfProcess); 129 launch_arguments_.AppendSwitch(switches::kPpapiOutOfProcess);
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 TEST_F(OutOfProcessPPAPITest, FAILS_Transport) { 272 TEST_F(OutOfProcessPPAPITest, FAILS_Transport) {
266 RunTestViaHTTP("Transport"); 273 RunTestViaHTTP("Transport");
267 } 274 }
268 #endif // ENABLE_P2P_APIS 275 #endif // ENABLE_P2P_APIS
269 276
270 TEST_PPAPI_IN_PROCESS(UMA) 277 TEST_PPAPI_IN_PROCESS(UMA)
271 // There is no proxy. 278 // There is no proxy.
272 TEST_F(OutOfProcessPPAPITest, FAILS_UMA) { 279 TEST_F(OutOfProcessPPAPITest, FAILS_UMA) {
273 RunTest("UMA"); 280 RunTest("UMA");
274 } 281 }
OLDNEW
« no previous file with comments | « no previous file | ppapi/tests/testing_instance.h » ('j') | ppapi/tests/testing_instance.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698