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

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

Issue 8642001: Add RunTestWithWebSocketServer for subsequent Pepper WebSocket API tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: use PathService::Get(chrome::DIR_LAYOUT_TESTS) Created 9 years, 1 month 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 | no next file » | no next file with comments »
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 "content/browser/plugin_service.h" 9 #include "content/browser/plugin_service.h"
10 #include "content/public/common/content_switches.h" 10 #include "content/public/common/content_switches.h"
11 #include "content/common/pepper_plugin_registry.h" 11 #include "content/common/pepper_plugin_registry.h"
12 #include "chrome/common/chrome_paths.h" 12 #include "chrome/common/chrome_paths.h"
13 #include "chrome/common/chrome_switches.h" 13 #include "chrome/common/chrome_switches.h"
14 #include "chrome/test/automation/tab_proxy.h" 14 #include "chrome/test/automation/tab_proxy.h"
15 #include "chrome/test/base/ui_test_utils.h"
15 #include "chrome/test/ui/ui_test.h" 16 #include "chrome/test/ui/ui_test.h"
16 #include "net/base/net_util.h" 17 #include "net/base/net_util.h"
17 #include "net/test/test_server.h" 18 #include "net/test/test_server.h"
18 #include "webkit/plugins/plugin_switches.h" 19 #include "webkit/plugins/plugin_switches.h"
19 20
20 21
21 namespace { 22 namespace {
22 23
23 // Platform-specific filename relative to the chrome executable. 24 // Platform-specific filename relative to the chrome executable.
24 #if defined(OS_WIN) 25 #if defined(OS_WIN)
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 for (; match < exe_size; ++match) { 100 for (; match < exe_size; ++match) {
100 web_dir = web_dir.Append(exe_parts[match]); 101 web_dir = web_dir.Append(exe_parts[match]);
101 } 102 }
102 103
103 net::TestServer test_server(net::TestServer::TYPE_HTTP, web_dir); 104 net::TestServer test_server(net::TestServer::TYPE_HTTP, web_dir);
104 ASSERT_TRUE(test_server.Start()); 105 ASSERT_TRUE(test_server.Start());
105 std::string query = BuildQuery("files/test_case.html?", test_case); 106 std::string query = BuildQuery("files/test_case.html?", test_case);
106 RunTestURL(test_server.GetURL(query)); 107 RunTestURL(test_server.GetURL(query));
107 } 108 }
108 109
110 void RunTestWithWebSocketServer(const std::string& test_case) {
111 FilePath websocket_root_dir;
112 ASSERT_TRUE(
113 PathService::Get(chrome::DIR_LAYOUT_TESTS, &websocket_root_dir));
114
115 ui_test_utils::TestWebSocketServer server;
116 ASSERT_TRUE(server.Start(websocket_root_dir));
117 RunTest(test_case);
118 }
119
109 private: 120 private:
110 void RunTestURL(const GURL& test_url) { 121 void RunTestURL(const GURL& test_url) {
111 scoped_refptr<TabProxy> tab(GetActiveTab()); 122 scoped_refptr<TabProxy> tab(GetActiveTab());
112 ASSERT_TRUE(tab.get()); 123 ASSERT_TRUE(tab.get());
113 ASSERT_TRUE(tab->NavigateToURL(test_url)); 124 ASSERT_TRUE(tab->NavigateToURL(test_url));
114 125
115 // See comment above TestingInstance in ppapi/test/testing_instance.h. 126 // See comment above TestingInstance in ppapi/test/testing_instance.h.
116 // Basically it sets a series of numbered cookies. The value of "..." means 127 // Basically it sets a series of numbered cookies. The value of "..." means
117 // it's still working and we should continue to wait, any other value 128 // it's still working and we should continue to wait, any other value
118 // indicates completion (in this case it will start with "PASS" or "FAIL"). 129 // indicates completion (in this case it will start with "PASS" or "FAIL").
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 TEST_PPAPI_IN_PROCESS(Flash_GetLocalTimeZoneOffset) 460 TEST_PPAPI_IN_PROCESS(Flash_GetLocalTimeZoneOffset)
450 TEST_PPAPI_IN_PROCESS(Flash_GetCommandLineArgs) 461 TEST_PPAPI_IN_PROCESS(Flash_GetCommandLineArgs)
451 TEST_PPAPI_OUT_OF_PROCESS(Flash_SetInstanceAlwaysOnTop) 462 TEST_PPAPI_OUT_OF_PROCESS(Flash_SetInstanceAlwaysOnTop)
452 TEST_PPAPI_OUT_OF_PROCESS(Flash_GetProxyForURL) 463 TEST_PPAPI_OUT_OF_PROCESS(Flash_GetProxyForURL)
453 TEST_PPAPI_OUT_OF_PROCESS(Flash_MessageLoop) 464 TEST_PPAPI_OUT_OF_PROCESS(Flash_MessageLoop)
454 TEST_PPAPI_OUT_OF_PROCESS(Flash_GetLocalTimeZoneOffset) 465 TEST_PPAPI_OUT_OF_PROCESS(Flash_GetLocalTimeZoneOffset)
455 TEST_PPAPI_OUT_OF_PROCESS(Flash_GetCommandLineArgs) 466 TEST_PPAPI_OUT_OF_PROCESS(Flash_GetCommandLineArgs)
456 467
457 TEST_PPAPI_IN_PROCESS(WebSocket_Create) 468 TEST_PPAPI_IN_PROCESS(WebSocket_Create)
458 TEST_PPAPI_IN_PROCESS(WebSocket_IsWebSocket) 469 TEST_PPAPI_IN_PROCESS(WebSocket_IsWebSocket)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698