OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/app/chrome_dll_resource.h" | 5 #include "chrome/app/chrome_dll_resource.h" |
6 #include "chrome/browser/views/find_bar_win.h" | 6 #include "chrome/browser/views/find_bar_win.h" |
7 #include "chrome/test/automation/browser_proxy.h" | 7 #include "chrome/test/automation/browser_proxy.h" |
8 #include "chrome/test/automation/tab_proxy.h" | 8 #include "chrome/test/automation/tab_proxy.h" |
9 #include "chrome/test/automation/window_proxy.h" | 9 #include "chrome/test/automation/window_proxy.h" |
10 #include "chrome/test/ui/ui_test.h" | 10 #include "chrome/test/ui/ui_test.h" |
11 #include "net/url_request/url_request_unittest.h" | 11 #include "net/url_request/url_request_unittest.h" |
12 | 12 |
13 class FindInPageControllerTest : public UITest { | 13 class FindInPageControllerTest : public UITest { |
14 public: | 14 public: |
15 FindInPageControllerTest() { | 15 FindInPageControllerTest() { |
16 show_window_ = true; | 16 show_window_ = true; |
17 } | 17 } |
18 }; | 18 }; |
19 | 19 |
20 const std::wstring kFramePage = L"files/find_in_page/frames.html"; | 20 const std::wstring kFramePage = L"files/find_in_page/frames.html"; |
| 21 const std::wstring kFrameData = L"files/find_in_page/framedata_general.html"; |
21 const std::wstring kUserSelectPage = L"files/find_in_page/user-select.html"; | 22 const std::wstring kUserSelectPage = L"files/find_in_page/user-select.html"; |
22 const std::wstring kCrashPage = L"files/find_in_page/crash_1341577.html"; | 23 const std::wstring kCrashPage = L"files/find_in_page/crash_1341577.html"; |
23 const std::wstring kTooFewMatchesPage = L"files/find_in_page/bug_1155639.html"; | 24 const std::wstring kTooFewMatchesPage = L"files/find_in_page/bug_1155639.html"; |
24 | 25 |
25 // This test loads a page with frames and starts FindInPage requests | 26 // This test loads a page with frames and starts FindInPage requests |
26 TEST_F(FindInPageControllerTest, FindInPageFrames) { | 27 TEST_F(FindInPageControllerTest, FindInPageFrames) { |
27 TestServer server(L"chrome/test/data"); | 28 TestServer server(L"chrome/test/data"); |
28 | 29 |
29 // First we navigate to our frames page. | 30 // First we navigate to our frames page. |
30 GURL url = server.TestServerPageW(kFramePage); | 31 GURL url = server.TestServerPageW(kFramePage); |
31 scoped_ptr<TabProxy> tab(GetActiveTab()); | 32 scoped_ptr<TabProxy> tab(GetActiveTab()); |
32 ASSERT_TRUE(tab->NavigateToURL(url)); | 33 ASSERT_TRUE(tab->NavigateToURL(url)); |
33 WaitUntilTabCount(1); | 34 WaitUntilTabCount(1); |
34 | 35 |
35 // Try incremental search (mimicking user typing in). | 36 // Try incremental search (mimicking user typing in). |
36 EXPECT_EQ(18, tab->FindInPage(L"g", FWD, IGNORE_CASE, false)); | 37 EXPECT_EQ(18, tab->FindInPage(L"g", FWD, IGNORE_CASE, false, NULL)); |
37 EXPECT_EQ(11, tab->FindInPage(L"go", FWD, IGNORE_CASE, false)); | 38 EXPECT_EQ(11, tab->FindInPage(L"go", FWD, IGNORE_CASE, false, NULL)); |
38 EXPECT_EQ(04, tab->FindInPage(L"goo", FWD, IGNORE_CASE, false)); | 39 EXPECT_EQ(04, tab->FindInPage(L"goo", FWD, IGNORE_CASE, false, NULL)); |
39 EXPECT_EQ(03, tab->FindInPage(L"goog", FWD, IGNORE_CASE, false)); | 40 EXPECT_EQ(03, tab->FindInPage(L"goog", FWD, IGNORE_CASE, false, NULL)); |
40 EXPECT_EQ(02, tab->FindInPage(L"googl", FWD, IGNORE_CASE, false)); | 41 EXPECT_EQ(02, tab->FindInPage(L"googl", FWD, IGNORE_CASE, false, NULL)); |
41 EXPECT_EQ(01, tab->FindInPage(L"google", FWD, IGNORE_CASE, false)); | 42 EXPECT_EQ(01, tab->FindInPage(L"google", FWD, IGNORE_CASE, false, NULL)); |
42 EXPECT_EQ(00, tab->FindInPage(L"google!", FWD, IGNORE_CASE, false)); | 43 EXPECT_EQ(00, tab->FindInPage(L"google!", FWD, IGNORE_CASE, false, NULL)); |
43 | 44 |
44 // Negative test (no matches should be found). | 45 // Negative test (no matches should be found). |
45 EXPECT_EQ(0, tab->FindInPage(L"Non-existing string", FWD, IGNORE_CASE, | 46 EXPECT_EQ(0, tab->FindInPage(L"Non-existing string", FWD, IGNORE_CASE, |
46 false)); | 47 false, NULL)); |
47 | 48 |
48 // 'horse' only exists in the three right frames. | 49 // 'horse' only exists in the three right frames. |
49 EXPECT_EQ(3, tab->FindInPage(L"horse", FWD, IGNORE_CASE, false)); | 50 EXPECT_EQ(3, tab->FindInPage(L"horse", FWD, IGNORE_CASE, false, NULL)); |
50 | 51 |
51 // 'cat' only exists in the first frame. | 52 // 'cat' only exists in the first frame. |
52 EXPECT_EQ(1, tab->FindInPage(L"cat", FWD, IGNORE_CASE, false)); | 53 EXPECT_EQ(1, tab->FindInPage(L"cat", FWD, IGNORE_CASE, false, NULL)); |
53 | 54 |
54 // Try searching again, should still come up with 1 match. | 55 // Try searching again, should still come up with 1 match. |
55 EXPECT_EQ(1, tab->FindInPage(L"cat", FWD, IGNORE_CASE, false)); | 56 EXPECT_EQ(1, tab->FindInPage(L"cat", FWD, IGNORE_CASE, false, NULL)); |
56 | 57 |
57 // Try searching backwards, ignoring case, should still come up with 1 match. | 58 // Try searching backwards, ignoring case, should still come up with 1 match. |
58 EXPECT_EQ(1, tab->FindInPage(L"CAT", BACK, IGNORE_CASE, false)); | 59 EXPECT_EQ(1, tab->FindInPage(L"CAT", BACK, IGNORE_CASE, false, NULL)); |
59 | 60 |
60 // Try case sensitive, should NOT find it. | 61 // Try case sensitive, should NOT find it. |
61 EXPECT_EQ(0, tab->FindInPage(L"CAT", FWD, CASE_SENSITIVE, false)); | 62 EXPECT_EQ(0, tab->FindInPage(L"CAT", FWD, CASE_SENSITIVE, false, NULL)); |
62 | 63 |
63 // Try again case sensitive, but this time with right case. | 64 // Try again case sensitive, but this time with right case. |
64 EXPECT_EQ(1, tab->FindInPage(L"dog", FWD, CASE_SENSITIVE, false)); | 65 EXPECT_EQ(1, tab->FindInPage(L"dog", FWD, CASE_SENSITIVE, false, NULL)); |
65 | 66 |
66 // Try non-Latin characters ('Hreggvidur' with 'eth' for 'd' in left frame). | 67 // Try non-Latin characters ('Hreggvidur' with 'eth' for 'd' in left frame). |
67 EXPECT_EQ(1, tab->FindInPage(L"Hreggvi\u00F0ur", FWD, IGNORE_CASE, false)); | 68 EXPECT_EQ(1, tab->FindInPage(L"Hreggvi\u00F0ur", FWD, IGNORE_CASE, |
68 EXPECT_EQ(1, tab->FindInPage(L"Hreggvi\u00F0ur", FWD, CASE_SENSITIVE, false)); | 69 false, NULL)); |
69 EXPECT_EQ(0, tab->FindInPage(L"hreggvi\u00F0ur", FWD, CASE_SENSITIVE, false)); | 70 EXPECT_EQ(1, tab->FindInPage(L"Hreggvi\u00F0ur", FWD, CASE_SENSITIVE, |
| 71 false, NULL)); |
| 72 EXPECT_EQ(0, tab->FindInPage(L"hreggvi\u00F0ur", FWD, CASE_SENSITIVE, |
| 73 false, NULL)); |
| 74 } |
| 75 |
| 76 // This test loads a single-frame page and makes sure the ordinal returned makes |
| 77 // sense as we FindNext over all the items. |
| 78 TEST_F(FindInPageControllerTest, FindInPageOrdinal) { |
| 79 TestServer server(L"chrome/test/data"); |
| 80 |
| 81 // First we navigate to our frames page. |
| 82 GURL url = server.TestServerPageW(kFrameData); |
| 83 scoped_ptr<TabProxy> tab(GetActiveTab()); |
| 84 ASSERT_TRUE(tab->NavigateToURL(url)); |
| 85 WaitUntilTabCount(1); |
| 86 |
| 87 // Search for 'o', which should make the first item active and return |
| 88 // '1 in 3' (1st ordinal of a total of 3 matches). |
| 89 int ordinal = 0; |
| 90 EXPECT_EQ(3, tab->FindInPage(L"o", FWD, IGNORE_CASE, false, &ordinal)); |
| 91 EXPECT_EQ(1, ordinal); |
| 92 // FindNext returns -1 for match count because it doesn't bother with |
| 93 // recounting the number of matches. We don't care about the match count |
| 94 // anyway in this case, we just want to check the ordinal. |
| 95 EXPECT_EQ(-1, tab->FindInPage(L"o", FWD, IGNORE_CASE, true, &ordinal)); |
| 96 EXPECT_EQ(2, ordinal); |
| 97 EXPECT_EQ(-1, tab->FindInPage(L"o", FWD, IGNORE_CASE, true, &ordinal)); |
| 98 EXPECT_EQ(3, ordinal); |
| 99 // Go back one match. |
| 100 EXPECT_EQ(-1, tab->FindInPage(L"o", BACK, IGNORE_CASE, true, &ordinal)); |
| 101 EXPECT_EQ(2, ordinal); |
| 102 EXPECT_EQ(-1, tab->FindInPage(L"o", FWD, IGNORE_CASE, true, &ordinal)); |
| 103 EXPECT_EQ(3, ordinal); |
| 104 // This should wrap to the top. |
| 105 EXPECT_EQ(-1, tab->FindInPage(L"o", FWD, IGNORE_CASE, true, &ordinal)); |
| 106 EXPECT_EQ(1, ordinal); |
| 107 // This should go back to the end. |
| 108 EXPECT_EQ(-1, tab->FindInPage(L"o", BACK, IGNORE_CASE, true, &ordinal)); |
| 109 EXPECT_EQ(3, ordinal); |
| 110 } |
| 111 |
| 112 // This test loads a page with frames and makes sure the ordinal returned makes |
| 113 // sense. |
| 114 TEST_F(FindInPageControllerTest, FindInPageMultiFramesOrdinal) { |
| 115 TestServer server(L"chrome/test/data"); |
| 116 |
| 117 // First we navigate to our frames page. |
| 118 GURL url = server.TestServerPageW(kFramePage); |
| 119 scoped_ptr<TabProxy> tab(GetActiveTab()); |
| 120 ASSERT_TRUE(tab->NavigateToURL(url)); |
| 121 WaitUntilTabCount(1); |
| 122 |
| 123 // Search for 'a', which should make the first item active and return |
| 124 // '1 in 7' (1st ordinal of a total of 7 matches). |
| 125 int ordinal = 0; |
| 126 EXPECT_EQ(7, tab->FindInPage(L"a", FWD, IGNORE_CASE, false, &ordinal)); |
| 127 EXPECT_EQ(1, ordinal); |
| 128 // FindNext returns -1 for match count because it doesn't bother with |
| 129 // recounting the number of matches. We don't care about the match count |
| 130 // anyway in this case, we just want to check the ordinal. |
| 131 EXPECT_EQ(-1, tab->FindInPage(L"a", FWD, IGNORE_CASE, true, &ordinal)); |
| 132 EXPECT_EQ(2, ordinal); |
| 133 EXPECT_EQ(-1, tab->FindInPage(L"a", FWD, IGNORE_CASE, true, &ordinal)); |
| 134 EXPECT_EQ(3, ordinal); |
| 135 EXPECT_EQ(-1, tab->FindInPage(L"a", FWD, IGNORE_CASE, true, &ordinal)); |
| 136 EXPECT_EQ(4, ordinal); |
| 137 // Go back one, which should go back one frame. |
| 138 EXPECT_EQ(-1, tab->FindInPage(L"a", BACK, IGNORE_CASE, true, &ordinal)); |
| 139 EXPECT_EQ(3, ordinal); |
| 140 EXPECT_EQ(-1, tab->FindInPage(L"a", FWD, IGNORE_CASE, true, &ordinal)); |
| 141 EXPECT_EQ(4, ordinal); |
| 142 EXPECT_EQ(-1, tab->FindInPage(L"a", FWD, IGNORE_CASE, true, &ordinal)); |
| 143 EXPECT_EQ(5, ordinal); |
| 144 EXPECT_EQ(-1, tab->FindInPage(L"a", FWD, IGNORE_CASE, true, &ordinal)); |
| 145 EXPECT_EQ(6, ordinal); |
| 146 EXPECT_EQ(-1, tab->FindInPage(L"a", FWD, IGNORE_CASE, true, &ordinal)); |
| 147 EXPECT_EQ(7, ordinal); |
| 148 // Now we should wrap back to frame 1. |
| 149 EXPECT_EQ(-1, tab->FindInPage(L"a", FWD, IGNORE_CASE, true, &ordinal)); |
| 150 EXPECT_EQ(1, ordinal); |
| 151 // Now we should wrap back to frame last frame. |
| 152 EXPECT_EQ(-1, tab->FindInPage(L"a", BACK, IGNORE_CASE, true, &ordinal)); |
| 153 EXPECT_EQ(7, ordinal); |
70 } | 154 } |
71 | 155 |
72 // Load a page with no selectable text and make sure we don't crash. | 156 // Load a page with no selectable text and make sure we don't crash. |
73 TEST_F(FindInPageControllerTest, FindUnSelectableText) { | 157 TEST_F(FindInPageControllerTest, FindUnSelectableText) { |
74 TestServer server(L"chrome/test/data"); | 158 TestServer server(L"chrome/test/data"); |
75 | 159 |
76 GURL url = server.TestServerPageW(kUserSelectPage); | 160 GURL url = server.TestServerPageW(kUserSelectPage); |
77 scoped_ptr<TabProxy> tab(GetActiveTab()); | 161 scoped_ptr<TabProxy> tab(GetActiveTab()); |
78 ASSERT_TRUE(tab->NavigateToURL(url)); | 162 ASSERT_TRUE(tab->NavigateToURL(url)); |
79 WaitUntilTabCount(1); | 163 WaitUntilTabCount(1); |
80 | 164 |
81 EXPECT_EQ(0, tab->FindInPage(L"text", FWD, IGNORE_CASE, false)); | 165 EXPECT_EQ(0, tab->FindInPage(L"text", FWD, IGNORE_CASE, false, NULL)); |
82 EXPECT_EQ(0, tab->FindInPage(L"Non-existing string", FWD, IGNORE_CASE, | 166 EXPECT_EQ(0, tab->FindInPage(L"Non-existing string", FWD, IGNORE_CASE, |
83 false)); | 167 false, NULL)); |
84 } | 168 } |
85 | 169 |
86 // Try to reproduce the crash seen in issue 1341577. | 170 // Try to reproduce the crash seen in issue 1341577. |
87 TEST_F(FindInPageControllerTest, FindCrash_Issue1341577) { | 171 TEST_F(FindInPageControllerTest, FindCrash_Issue1341577) { |
88 TestServer server(L"chrome/test/data"); | 172 TestServer server(L"chrome/test/data"); |
89 | 173 |
90 GURL url = server.TestServerPageW(kCrashPage); | 174 GURL url = server.TestServerPageW(kCrashPage); |
91 scoped_ptr<TabProxy> tab(GetActiveTab()); | 175 scoped_ptr<TabProxy> tab(GetActiveTab()); |
92 ASSERT_TRUE(tab->NavigateToURL(url)); | 176 ASSERT_TRUE(tab->NavigateToURL(url)); |
93 WaitUntilTabCount(1); | 177 WaitUntilTabCount(1); |
94 | 178 |
95 // This would crash the tab. These must be the first two find requests issued | 179 // This would crash the tab. These must be the first two find requests issued |
96 // against the frame, otherwise an active frame pointer is set and it wont | 180 // against the frame, otherwise an active frame pointer is set and it wont |
97 // produce the crash. | 181 // produce the crash. |
98 EXPECT_EQ(1, tab->FindInPage(L"\u0D4C", FWD, IGNORE_CASE, false)); | 182 EXPECT_EQ(1, tab->FindInPage(L"\u0D4C", FWD, IGNORE_CASE, false, NULL)); |
99 // FindNext returns -1 for match count because it doesn't bother with | 183 // FindNext returns -1 for match count because it doesn't bother with |
100 // recounting the number of matches. We don't care about the match count | 184 // recounting the number of matches. We don't care about the match count |
101 // anyway in this case, we just want to make sure it doesn't crash. | 185 // anyway in this case, we just want to make sure it doesn't crash. |
102 EXPECT_EQ(-1, tab->FindInPage(L"\u0D4C", FWD, IGNORE_CASE, true)); | 186 EXPECT_EQ(-1, tab->FindInPage(L"\u0D4C", FWD, IGNORE_CASE, true, NULL)); |
103 | 187 |
104 // This should work fine. | 188 // This should work fine. |
105 EXPECT_EQ(1, tab->FindInPage(L"\u0D24\u0D46", FWD, IGNORE_CASE, false)); | 189 EXPECT_EQ(1, tab->FindInPage(L"\u0D24\u0D46", FWD, IGNORE_CASE, false, NULL)); |
106 EXPECT_EQ(0, tab->FindInPage(L"nostring", FWD, IGNORE_CASE, false)); | 190 EXPECT_EQ(0, tab->FindInPage(L"nostring", FWD, IGNORE_CASE, false, NULL)); |
107 } | 191 } |
108 | 192 |
109 // Test to make sure Find does the right thing when restarting from a timeout. | 193 // Test to make sure Find does the right thing when restarting from a timeout. |
110 // We used to have a problem where we'd stop finding matches when all of the | 194 // We used to have a problem where we'd stop finding matches when all of the |
111 // following conditions were true: | 195 // following conditions were true: |
112 // 1) The page has a lot of text to search. | 196 // 1) The page has a lot of text to search. |
113 // 2) The page contains more than one match. | 197 // 2) The page contains more than one match. |
114 // 3) It takes longer than the time-slice given to each Find operation (100 | 198 // 3) It takes longer than the time-slice given to each Find operation (100 |
115 // ms) to find one or more of those matches (so Find times out and has to try | 199 // ms) to find one or more of those matches (so Find times out and has to try |
116 // again from where it left off). | 200 // again from where it left off). |
117 TEST_F(FindInPageControllerTest, FindEnoughMatches_Issue1155639) { | 201 TEST_F(FindInPageControllerTest, FindEnoughMatches_Issue1155639) { |
118 TestServer server(L"chrome/test/data"); | 202 TestServer server(L"chrome/test/data"); |
119 | 203 |
120 GURL url = server.TestServerPageW(kTooFewMatchesPage); | 204 GURL url = server.TestServerPageW(kTooFewMatchesPage); |
121 scoped_ptr<TabProxy> tab(GetActiveTab()); | 205 scoped_ptr<TabProxy> tab(GetActiveTab()); |
122 ASSERT_TRUE(tab->NavigateToURL(url)); | 206 ASSERT_TRUE(tab->NavigateToURL(url)); |
123 WaitUntilTabCount(1); | 207 WaitUntilTabCount(1); |
124 | 208 |
125 // This string appears 5 times at the bottom of a long page. If Find restarts | 209 // This string appears 5 times at the bottom of a long page. If Find restarts |
126 // properly after a timeout, it will find 5 matches, not just 1. | 210 // properly after a timeout, it will find 5 matches, not just 1. |
127 EXPECT_EQ(5, tab->FindInPage(L"008.xml", FWD, IGNORE_CASE, false)); | 211 EXPECT_EQ(5, tab->FindInPage(L"008.xml", FWD, IGNORE_CASE, false, NULL)); |
128 } | 212 } |
129 | 213 |
130 // The find window should not change its location just because we open and close | 214 // The find window should not change its location just because we open and close |
131 // a new tab. | 215 // a new tab. |
132 TEST_F(FindInPageControllerTest, FindMovesOnTabClose_Issue1343052) { | 216 TEST_F(FindInPageControllerTest, FindMovesOnTabClose_Issue1343052) { |
133 fprintf(stderr, "Starting FindMovesOnTabClose_Issue1343052\n"); | |
134 TestServer server(L"chrome/test/data"); | 217 TestServer server(L"chrome/test/data"); |
135 | 218 |
136 fprintf(stderr, "TestServerPageW\n"); | |
137 GURL url = server.TestServerPageW(kFramePage); | 219 GURL url = server.TestServerPageW(kFramePage); |
138 fprintf(stderr, "GetActiveTab A\n"); | |
139 scoped_ptr<TabProxy> tabA(GetActiveTab()); | 220 scoped_ptr<TabProxy> tabA(GetActiveTab()); |
140 fprintf(stderr, "Navigate A\n"); | |
141 ASSERT_TRUE(tabA->NavigateToURL(url)); | 221 ASSERT_TRUE(tabA->NavigateToURL(url)); |
142 fprintf(stderr, "WaitUntilTabCount(1) for A\n"); | |
143 WaitUntilTabCount(1); | 222 WaitUntilTabCount(1); |
144 | 223 |
145 fprintf(stderr, "GetBrowserWindow(0)\n"); | |
146 scoped_ptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); | 224 scoped_ptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); |
147 ASSERT_TRUE(browser.get() != NULL); | 225 ASSERT_TRUE(browser.get() != NULL); |
148 | 226 |
149 // Toggle the bookmark bar state. | 227 // Toggle the bookmark bar state. |
150 fprintf(stderr, "ApplyAccelerator bookmark bar\n"); | |
151 browser->ApplyAccelerator(IDC_SHOW_BOOKMARKS_BAR); | 228 browser->ApplyAccelerator(IDC_SHOW_BOOKMARKS_BAR); |
152 fprintf(stderr, "WaitForBookmarkVisibility\n"); | |
153 EXPECT_TRUE(WaitForBookmarkBarVisibilityChange(browser.get(), true)); | 229 EXPECT_TRUE(WaitForBookmarkBarVisibilityChange(browser.get(), true)); |
154 | 230 |
155 // Open the Find window and wait for it to animate. | 231 // Open the Find window and wait for it to animate. |
156 fprintf(stderr, "OpenFindInPage in A\n"); | |
157 EXPECT_TRUE(tabA->OpenFindInPage()); | 232 EXPECT_TRUE(tabA->OpenFindInPage()); |
158 fprintf(stderr, "WaitForWindowFullyVisible in A\n"); | |
159 EXPECT_TRUE(WaitForFindWindowFullyVisible(tabA.get())); | 233 EXPECT_TRUE(WaitForFindWindowFullyVisible(tabA.get())); |
160 | 234 |
161 // Find its location. | 235 // Find its location. |
162 int x = -1, y = -1; | 236 int x = -1, y = -1; |
163 fprintf(stderr, "GetFindWindowLocation in A\n"); | |
164 EXPECT_TRUE(tabA->GetFindWindowLocation(&x, &y)); | 237 EXPECT_TRUE(tabA->GetFindWindowLocation(&x, &y)); |
165 | 238 |
166 // Open another tab (tab B). | 239 // Open another tab (tab B). |
167 fprintf(stderr, "AppendTab B\n"); | |
168 EXPECT_TRUE(browser->AppendTab(url)); | 240 EXPECT_TRUE(browser->AppendTab(url)); |
169 fprintf(stderr, "GetActiveTab B\n"); | |
170 scoped_ptr<TabProxy> tabB(GetActiveTab()); | 241 scoped_ptr<TabProxy> tabB(GetActiveTab()); |
171 | 242 |
172 // Close tab B. | 243 // Close tab B. |
173 fprintf(stderr, "Tab Close B\n"); | |
174 EXPECT_TRUE(tabB->Close(true)); | 244 EXPECT_TRUE(tabB->Close(true)); |
175 | 245 |
176 // See if the Find window has moved. | 246 // See if the Find window has moved. |
177 int new_x = -1, new_y = -1; | 247 int new_x = -1, new_y = -1; |
178 fprintf(stderr, "GetFindWindowLocation in A\n"); | |
179 EXPECT_TRUE(tabA->GetFindWindowLocation(&new_x, &new_y)); | 248 EXPECT_TRUE(tabA->GetFindWindowLocation(&new_x, &new_y)); |
180 | 249 |
181 EXPECT_EQ(x, new_x); | 250 EXPECT_EQ(x, new_x); |
182 EXPECT_EQ(y, new_y); | 251 EXPECT_EQ(y, new_y); |
183 | 252 |
184 // Now reset the bookmarks bar state and try the same again. | 253 // Now reset the bookmarks bar state and try the same again. |
185 fprintf(stderr, "ApplyAccelerator BookmarksBar\n"); | |
186 browser->ApplyAccelerator(IDC_SHOW_BOOKMARKS_BAR); | 254 browser->ApplyAccelerator(IDC_SHOW_BOOKMARKS_BAR); |
187 fprintf(stderr, "WaitForBookmarkBarVisibilityChange\n"); | |
188 EXPECT_TRUE(WaitForBookmarkBarVisibilityChange(browser.get(), false)); | 255 EXPECT_TRUE(WaitForBookmarkBarVisibilityChange(browser.get(), false)); |
189 | 256 |
190 // Bookmark bar has moved, reset our coordinates. | 257 // Bookmark bar has moved, reset our coordinates. |
191 fprintf(stderr, "GetFindWindowLocation again\n"); | |
192 EXPECT_TRUE(tabA->GetFindWindowLocation(&x, &y)); | 258 EXPECT_TRUE(tabA->GetFindWindowLocation(&x, &y)); |
193 | 259 |
194 // Open another tab (tab C). | 260 // Open another tab (tab C). |
195 fprintf(stderr, "Append tab C\n"); | |
196 EXPECT_TRUE(browser->AppendTab(url)); | 261 EXPECT_TRUE(browser->AppendTab(url)); |
197 fprintf(stderr, "GetActiveTab C\n"); | |
198 scoped_ptr<TabProxy> tabC(GetActiveTab()); | 262 scoped_ptr<TabProxy> tabC(GetActiveTab()); |
199 | 263 |
200 // Close it. | 264 // Close it. |
201 fprintf(stderr, "Close tab C\n"); | |
202 EXPECT_TRUE(tabC->Close(true)); | 265 EXPECT_TRUE(tabC->Close(true)); |
203 | 266 |
204 // See if the Find window has moved. | 267 // See if the Find window has moved. |
205 fprintf(stderr, "GetFindWindowLocation yet again\n"); | |
206 EXPECT_TRUE(tabA->GetFindWindowLocation(&new_x, &new_y)); | 268 EXPECT_TRUE(tabA->GetFindWindowLocation(&new_x, &new_y)); |
207 | 269 |
208 EXPECT_EQ(x, new_x); | 270 EXPECT_EQ(x, new_x); |
209 EXPECT_EQ(y, new_y); | 271 EXPECT_EQ(y, new_y); |
210 fprintf(stderr, "Done!\n"); | |
211 } | 272 } |
OLD | NEW |