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

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

Issue 10702029: Move tab functions off Browser into browser_tabstrip and browser_tabrestore. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 5 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 | « chrome/test/perf/rendering/throughput_tests.cc ('k') | content/browser/DEPS » ('j') | 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) 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 #include "chrome/test/ui/ppapi_uitest.h" 5 #include "chrome/test/ui/ppapi_uitest.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
11 #include "base/stringprintf.h" 11 #include "base/stringprintf.h"
12 #include "base/string_util.h" 12 #include "base/string_util.h"
13 #include "base/test/test_timeouts.h" 13 #include "base/test/test_timeouts.h"
14 #include "base/timer.h" 14 #include "base/timer.h"
15 #include "build/build_config.h" 15 #include "build/build_config.h"
16 #include "chrome/browser/ui/browser.h" 16 #include "chrome/browser/ui/browser.h"
17 #include "chrome/browser/ui/browser_navigator.h" 17 #include "chrome/browser/ui/browser_navigator.h"
18 #include "chrome/browser/ui/browser_tabstrip.h"
18 #include "chrome/common/chrome_paths.h" 19 #include "chrome/common/chrome_paths.h"
19 #include "chrome/common/chrome_switches.h" 20 #include "chrome/common/chrome_switches.h"
20 #include "chrome/test/base/in_process_browser_test.h" 21 #include "chrome/test/base/in_process_browser_test.h"
21 #include "chrome/test/base/test_launcher_utils.h" 22 #include "chrome/test/base/test_launcher_utils.h"
22 #include "chrome/test/base/ui_test_utils.h" 23 #include "chrome/test/base/ui_test_utils.h"
23 #include "content/public/browser/dom_operation_notification_details.h" 24 #include "content/public/browser/dom_operation_notification_details.h"
24 #include "content/public/browser/notification_types.h" 25 #include "content/public/browser/notification_types.h"
25 #include "content/public/browser/web_contents.h" 26 #include "content/public/browser/web_contents.h"
26 #include "content/public/common/content_paths.h" 27 #include "content/public/common/content_paths.h"
27 #include "content/public/common/content_switches.h" 28 #include "content/public/common/content_switches.h"
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 return test_name; 239 return test_name;
239 } 240 }
240 241
241 void PPAPITestBase::RunTestURL(const GURL& test_url) { 242 void PPAPITestBase::RunTestURL(const GURL& test_url) {
242 // See comment above TestingInstance in ppapi/test/testing_instance.h. 243 // See comment above TestingInstance in ppapi/test/testing_instance.h.
243 // Basically it sends messages using the DOM automation controller. The 244 // Basically it sends messages using the DOM automation controller. The
244 // value of "..." means it's still working and we should continue to wait, 245 // value of "..." means it's still working and we should continue to wait,
245 // any other value indicates completion (in this case it will start with 246 // any other value indicates completion (in this case it will start with
246 // "PASS" or "FAIL"). This keeps us from timing out on waits for long tests. 247 // "PASS" or "FAIL"). This keeps us from timing out on waits for long tests.
247 TestFinishObserver observer( 248 TestFinishObserver observer(
248 browser()->GetActiveWebContents()->GetRenderViewHost(), kTimeoutMs); 249 chrome::GetActiveWebContents(browser())->GetRenderViewHost(), kTimeoutMs);
249 250
250 ui_test_utils::NavigateToURL(browser(), test_url); 251 ui_test_utils::NavigateToURL(browser(), test_url);
251 252
252 ASSERT_TRUE(observer.WaitForFinish()) << "Test timed out."; 253 ASSERT_TRUE(observer.WaitForFinish()) << "Test timed out.";
253 254
254 EXPECT_STREQ("PASS", observer.result().c_str()); 255 EXPECT_STREQ("PASS", observer.result().c_str());
255 } 256 }
256 257
257 void PPAPITestBase::RunHTTPTestServer( 258 void PPAPITestBase::RunHTTPTestServer(
258 const FilePath& document_root, 259 const FilePath& document_root,
(...skipping 822 matching lines...) Expand 10 before | Expand all | Expand 10 after
1081 GURL url = GetTestFileUrl("View_CreatedInvisible"); 1082 GURL url = GetTestFileUrl("View_CreatedInvisible");
1082 browser::NavigateParams params(browser(), url, content::PAGE_TRANSITION_LINK); 1083 browser::NavigateParams params(browser(), url, content::PAGE_TRANSITION_LINK);
1083 params.disposition = NEW_BACKGROUND_TAB; 1084 params.disposition = NEW_BACKGROUND_TAB;
1084 ui_test_utils::NavigateToURL(&params); 1085 ui_test_utils::NavigateToURL(&params);
1085 } 1086 }
1086 1087
1087 // This test messes with tab visibility so is custom. 1088 // This test messes with tab visibility so is custom.
1088 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, View_PageHideShow) { 1089 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, View_PageHideShow) {
1089 // The plugin will be loaded in the foreground tab and will send us a message. 1090 // The plugin will be loaded in the foreground tab and will send us a message.
1090 TestFinishObserver observer( 1091 TestFinishObserver observer(
1091 browser()->GetActiveWebContents()->GetRenderViewHost(), 1092 chrome::GetActiveWebContents(browser())->GetRenderViewHost(),
1092 TestTimeouts::action_max_timeout_ms()); 1093 TestTimeouts::action_max_timeout_ms());
1093 1094
1094 GURL url = GetTestFileUrl("View_PageHideShow"); 1095 GURL url = GetTestFileUrl("View_PageHideShow");
1095 ui_test_utils::NavigateToURL(browser(), url); 1096 ui_test_utils::NavigateToURL(browser(), url);
1096 1097
1097 ASSERT_TRUE(observer.WaitForFinish()) << "Test timed out."; 1098 ASSERT_TRUE(observer.WaitForFinish()) << "Test timed out.";
1098 EXPECT_STREQ("TestPageHideShow:Created", observer.result().c_str()); 1099 EXPECT_STREQ("TestPageHideShow:Created", observer.result().c_str());
1099 observer.Reset(); 1100 observer.Reset();
1100 1101
1101 // Make a new tab to cause the original one to hide, this should trigger the 1102 // Make a new tab to cause the original one to hide, this should trigger the
1102 // next phase of the test. 1103 // next phase of the test.
1103 browser::NavigateParams params( 1104 browser::NavigateParams params(
1104 browser(), GURL(chrome::kAboutBlankURL), content::PAGE_TRANSITION_LINK); 1105 browser(), GURL(chrome::kAboutBlankURL), content::PAGE_TRANSITION_LINK);
1105 params.disposition = NEW_FOREGROUND_TAB; 1106 params.disposition = NEW_FOREGROUND_TAB;
1106 ui_test_utils::NavigateToURL(&params); 1107 ui_test_utils::NavigateToURL(&params);
1107 1108
1108 // Wait until the test acks that it got hidden. 1109 // Wait until the test acks that it got hidden.
1109 ASSERT_TRUE(observer.WaitForFinish()) << "Test timed out."; 1110 ASSERT_TRUE(observer.WaitForFinish()) << "Test timed out.";
1110 EXPECT_STREQ("TestPageHideShow:Hidden", observer.result().c_str()); 1111 EXPECT_STREQ("TestPageHideShow:Hidden", observer.result().c_str());
1111 1112
1112 // Wait for the test completion event. 1113 // Wait for the test completion event.
1113 observer.Reset(); 1114 observer.Reset();
1114 1115
1115 // Switch back to the test tab. 1116 // Switch back to the test tab.
1116 browser()->ActivateTabAt(0, true); 1117 chrome::ActivateTabAt(browser(), 0, true);
1117 1118
1118 ASSERT_TRUE(observer.WaitForFinish()) << "Test timed out."; 1119 ASSERT_TRUE(observer.WaitForFinish()) << "Test timed out.";
1119 EXPECT_STREQ("PASS", observer.result().c_str()); 1120 EXPECT_STREQ("PASS", observer.result().c_str());
1120 } 1121 }
1121 1122
1122 // Tests that if a plugin accepts touch events, the browser knows to send touch 1123 // Tests that if a plugin accepts touch events, the browser knows to send touch
1123 // events to the renderer. 1124 // events to the renderer.
1124 IN_PROC_BROWSER_TEST_F(PPAPITest, InputEvent_AcceptTouchEvent) { 1125 IN_PROC_BROWSER_TEST_F(PPAPITest, InputEvent_AcceptTouchEvent) {
1125 std::string positive_tests[] = { "InputEvent_AcceptTouchEvent_1", 1126 std::string positive_tests[] = { "InputEvent_AcceptTouchEvent_1",
1126 "InputEvent_AcceptTouchEvent_3", 1127 "InputEvent_AcceptTouchEvent_3",
1127 "InputEvent_AcceptTouchEvent_4" 1128 "InputEvent_AcceptTouchEvent_4"
1128 }; 1129 };
1129 1130
1130 for (size_t i = 0; i < arraysize(positive_tests); ++i) { 1131 for (size_t i = 0; i < arraysize(positive_tests); ++i) {
1131 RenderViewHost* host = browser()->GetActiveWebContents()-> 1132 RenderViewHost* host = chrome::GetActiveWebContents(browser())->
1132 GetRenderViewHost(); 1133 GetRenderViewHost();
1133 RunTest(positive_tests[i]); 1134 RunTest(positive_tests[i]);
1134 EXPECT_TRUE(content::RenderViewHostTester::HasTouchEventHandler(host)); 1135 EXPECT_TRUE(content::RenderViewHostTester::HasTouchEventHandler(host));
1135 } 1136 }
1136 1137
1137 std::string negative_tests[] = { "InputEvent_AcceptTouchEvent_2" }; 1138 std::string negative_tests[] = { "InputEvent_AcceptTouchEvent_2" };
1138 for (size_t i = 0; i < arraysize(negative_tests); ++i) { 1139 for (size_t i = 0; i < arraysize(negative_tests); ++i) {
1139 RenderViewHost* host = browser()->GetActiveWebContents()-> 1140 RenderViewHost* host = chrome::GetActiveWebContents(browser())->
1140 GetRenderViewHost(); 1141 GetRenderViewHost();
1141 RunTest(negative_tests[i]); 1142 RunTest(negative_tests[i]);
1142 EXPECT_FALSE(content::RenderViewHostTester::HasTouchEventHandler(host)); 1143 EXPECT_FALSE(content::RenderViewHostTester::HasTouchEventHandler(host));
1143 } 1144 }
1144 } 1145 }
1145 1146
1146 TEST_PPAPI_IN_PROCESS(View_SizeChange); 1147 TEST_PPAPI_IN_PROCESS(View_SizeChange);
1147 TEST_PPAPI_OUT_OF_PROCESS(View_SizeChange); 1148 TEST_PPAPI_OUT_OF_PROCESS(View_SizeChange);
1148 TEST_PPAPI_NACL_VIA_HTTP(View_SizeChange); 1149 TEST_PPAPI_NACL_VIA_HTTP(View_SizeChange);
1149 TEST_PPAPI_IN_PROCESS(View_ClipChange); 1150 TEST_PPAPI_IN_PROCESS(View_ClipChange);
(...skipping 15 matching lines...) Expand all
1165 TEST_PPAPI_OUT_OF_PROCESS(FlashMessageLoop_RunWithoutQuit) 1166 TEST_PPAPI_OUT_OF_PROCESS(FlashMessageLoop_RunWithoutQuit)
1166 1167
1167 TEST_PPAPI_IN_PROCESS(MouseCursor) 1168 TEST_PPAPI_IN_PROCESS(MouseCursor)
1168 TEST_PPAPI_OUT_OF_PROCESS(MouseCursor) 1169 TEST_PPAPI_OUT_OF_PROCESS(MouseCursor)
1169 TEST_PPAPI_NACL_VIA_HTTP(MouseCursor) 1170 TEST_PPAPI_NACL_VIA_HTTP(MouseCursor)
1170 1171
1171 // Only enabled in out-of-process mode. 1172 // Only enabled in out-of-process mode.
1172 TEST_PPAPI_OUT_OF_PROCESS(FlashFile_CreateTemporaryFile) 1173 TEST_PPAPI_OUT_OF_PROCESS(FlashFile_CreateTemporaryFile)
1173 1174
1174 #endif // ADDRESS_SANITIZER 1175 #endif // ADDRESS_SANITIZER
OLDNEW
« no previous file with comments | « chrome/test/perf/rendering/throughput_tests.cc ('k') | content/browser/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698