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

Side by Side Diff: chrome/browser/net/ftp_browsertest.cc

Issue 2641173005: Fix flaky FtpBrowserTest.DirectoryListingNavigation (Closed)
Patch Set: fix Created 3 years, 11 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
« 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) 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 "base/command_line.h" 5 #include "base/command_line.h"
6 #include "base/files/file_path.h" 6 #include "base/files/file_path.h"
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 #include "chrome/browser/ui/browser.h" 9 #include "chrome/browser/ui/browser.h"
10 #include "chrome/browser/ui/tabs/tab_strip_model.h" 10 #include "chrome/browser/ui/tabs/tab_strip_model.h"
(...skipping 28 matching lines...) Expand all
39 IN_PROC_BROWSER_TEST_F(FtpBrowserTest, BasicFtpUrlAuthentication) { 39 IN_PROC_BROWSER_TEST_F(FtpBrowserTest, BasicFtpUrlAuthentication) {
40 ASSERT_TRUE(ftp_server_.Start()); 40 ASSERT_TRUE(ftp_server_.Start());
41 ui_test_utils::NavigateToURL( 41 ui_test_utils::NavigateToURL(
42 browser(), 42 browser(),
43 ftp_server_.GetURLWithUserAndPassword("", "chrome", "chrome")); 43 ftp_server_.GetURLWithUserAndPassword("", "chrome", "chrome"));
44 44
45 WaitForTitle(browser()->tab_strip_model()->GetActiveWebContents(), 45 WaitForTitle(browser()->tab_strip_model()->GetActiveWebContents(),
46 "Index of /"); 46 "Index of /");
47 } 47 }
48 48
49 // http://crbug.com/521409 49 IN_PROC_BROWSER_TEST_F(FtpBrowserTest, DirectoryListingNavigation) {
50 #if defined(OS_WIN)
51 #define MAYBE_DirectoryListingNavigation DISABLED_DirectoryListingNavigation
52 #else
53 #define MAYBE_DirectoryListingNavigation DirectoryListingNavigation
54 #endif
55 IN_PROC_BROWSER_TEST_F(FtpBrowserTest, MAYBE_DirectoryListingNavigation) {
56 ftp_server_.set_no_anonymous_ftp_user(true); 50 ftp_server_.set_no_anonymous_ftp_user(true);
57 ASSERT_TRUE(ftp_server_.Start()); 51 ASSERT_TRUE(ftp_server_.Start());
58 52
59 ui_test_utils::NavigateToURL( 53 ui_test_utils::NavigateToURL(
60 browser(), 54 browser(),
61 ftp_server_.GetURLWithUserAndPassword("", "chrome", "chrome")); 55 ftp_server_.GetURLWithUserAndPassword("", "chrome", "chrome"));
62 56
63 // Navigate to directory dir1/ without needing to re-authenticate 57 // Navigate to directory dir1/ without needing to re-authenticate
64 EXPECT_TRUE(content::ExecuteScript( 58 EXPECT_TRUE(content::ExecuteScript(
65 browser()->tab_strip_model()->GetActiveWebContents(), 59 browser()->tab_strip_model()->GetActiveWebContents(),
66 "var elements = document.getElementsByTagName('a');" 60 "(function() {"
67 "for (var i = 0; i < elements.length; i++) {" 61 " function navigate() {"
68 " if (elements[i].innerHTML == 'dir1/') {" 62 " for (const element of document.getElementsByTagName('a')) {"
69 " elements[i].click();" 63 " if (element.innerHTML == 'dir1/') {"
64 " element.click();"
65 " }"
66 " }"
70 " }" 67 " }"
71 "}")); 68 " if (document.readyState === 'loading') {"
69 " document.addEventListener('DOMContentLoaded', navigate);"
70 " } else {"
71 " navigate();"
72 " }"
73 "})()"));
72 74
73 WaitForTitle(browser()->tab_strip_model()->GetActiveWebContents(), 75 WaitForTitle(browser()->tab_strip_model()->GetActiveWebContents(),
74 "Index of /dir1/"); 76 "Index of /dir1/");
75 77
76 EXPECT_TRUE(content::ExecuteScript( 78 EXPECT_TRUE(content::ExecuteScript(
77 browser()->tab_strip_model()->GetActiveWebContents(), 79 browser()->tab_strip_model()->GetActiveWebContents(),
78 "var elements = document.getElementsByTagName('a');" 80 "(function() {"
79 "for (var i = 0; i < elements.length; i++) {" 81 " function navigate() {"
80 " if (elements[i].innerHTML == 'test.html') {" 82 " for (const element of document.getElementsByTagName('a')) {"
81 " elements[i].click();" 83 " if (element.innerHTML == 'test.html') {"
82 " }" 84 " element.click();"
83 "}")); 85 " }"
86 " }"
87 " }"
88 " if (document.readyState === 'loading') {"
89 " document.addEventListener('DOMContentLoaded', navigate);"
90 " } else {"
91 " navigate();"
92 " }"
93 "})()"));
84 94
85 WaitForTitle(browser()->tab_strip_model()->GetActiveWebContents(), 95 WaitForTitle(browser()->tab_strip_model()->GetActiveWebContents(),
86 "PASS"); 96 "PASS");
87 } 97 }
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