OLD | NEW |
---|---|
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 <string> | 5 #include <string> |
6 | 6 |
7 #include "chrome/app/chrome_command_ids.h" | 7 #include "chrome/app/chrome_command_ids.h" |
8 #include "chrome/browser/net/url_fixer_upper.h" | 8 #include "chrome/browser/net/url_fixer_upper.h" |
9 #include "chrome/common/url_constants.h" | 9 #include "chrome/common/url_constants.h" |
10 #include "chrome/test/automation/automation_proxy.h" | 10 #include "chrome/test/automation/automation_proxy.h" |
(...skipping 30 matching lines...) Expand all Loading... | |
41 // Load a form. | 41 // Load a form. |
42 ASSERT_TRUE(tab->NavigateToURL(test_server.GetURL("files/form.html"))); | 42 ASSERT_TRUE(tab->NavigateToURL(test_server.GetURL("files/form.html"))); |
43 // Submit it. | 43 // Submit it. |
44 ASSERT_TRUE(tab->NavigateToURL(GURL( | 44 ASSERT_TRUE(tab->NavigateToURL(GURL( |
45 "javascript:document.getElementById('form').submit()"))); | 45 "javascript:document.getElementById('form').submit()"))); |
46 | 46 |
47 // Try to reload it twice, checking for repost. | 47 // Try to reload it twice, checking for repost. |
48 tab->ReloadAsync(); | 48 tab->ReloadAsync(); |
49 tab->ReloadAsync(); | 49 tab->ReloadAsync(); |
50 | 50 |
51 // There should only be one dialog open. | |
52 int num_constrained_windows = 0; | |
53 ASSERT_TRUE(tab->GetConstrainedWindowCount(&num_constrained_windows)); | |
Daniel Erat
2011/12/01 23:44:49
Do you happen to know if it's safe to check this i
Bernhard Bauer
2011/12/01 23:54:53
No, it should appear immediately. The async in the
| |
54 EXPECT_EQ(1, num_constrained_windows); | |
55 | |
51 // Navigate away from the page (this is when the test usually crashes). | 56 // Navigate away from the page (this is when the test usually crashes). |
52 ASSERT_TRUE(tab->NavigateToURL(test_server.GetURL("bar"))); | 57 ASSERT_TRUE(tab->NavigateToURL(test_server.GetURL("bar"))); |
58 | |
59 // The dialog should've been closed. | |
60 ASSERT_TRUE(tab->GetConstrainedWindowCount(&num_constrained_windows)); | |
61 EXPECT_EQ(0, num_constrained_windows); | |
53 } | 62 } |
54 | 63 |
55 #if defined(OS_WIN) | 64 #if defined(OS_WIN) |
56 // http://crbug.com/47228 | 65 // http://crbug.com/47228 |
57 #define MAYBE_TestLoginAfterRepost FLAKY_TestLoginAfterRepost | 66 #define MAYBE_TestLoginAfterRepost FLAKY_TestLoginAfterRepost |
58 #else | 67 #else |
59 #define MAYBE_TestLoginAfterRepost TestLoginAfterRepost | 68 #define MAYBE_TestLoginAfterRepost TestLoginAfterRepost |
60 #endif | 69 #endif |
61 | 70 |
62 TEST_F(RepostFormWarningTest, MAYBE_TestLoginAfterRepost) { | 71 TEST_F(RepostFormWarningTest, MAYBE_TestLoginAfterRepost) { |
(...skipping 18 matching lines...) Expand all Loading... | |
81 // Navigate to a page that requires authentication, bringing up another | 90 // Navigate to a page that requires authentication, bringing up another |
82 // tab-modal sheet. | 91 // tab-modal sheet. |
83 ASSERT_TRUE(tab->NavigateToURL(test_server.GetURL("auth-basic"))); | 92 ASSERT_TRUE(tab->NavigateToURL(test_server.GetURL("auth-basic"))); |
84 | 93 |
85 // Try to reload it again. | 94 // Try to reload it again. |
86 tab->ReloadAsync(); | 95 tab->ReloadAsync(); |
87 | 96 |
88 // Navigate away from the page. | 97 // Navigate away from the page. |
89 ASSERT_TRUE(tab->NavigateToURL(test_server.GetURL("bar"))); | 98 ASSERT_TRUE(tab->NavigateToURL(test_server.GetURL("bar"))); |
90 } | 99 } |
OLD | NEW |