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

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

Issue 10828245: Final set of conversions of automation calls to the JSON interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 4 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/ui/ui_test.h ('k') | 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 "chrome/test/ui/ui_test.h" 5 #include "chrome/test/ui/ui_test.h"
6 6
7 #if defined(OS_POSIX) 7 #if defined(OS_POSIX)
8 #include <signal.h> 8 #include <signal.h>
9 #include <sys/types.h> 9 #include <sys/types.h>
10 #endif 10 #endif
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 scoped_refptr<BrowserProxy> window = 306 scoped_refptr<BrowserProxy> window =
307 automation()->GetBrowserWindow(window_index); 307 automation()->GetBrowserWindow(window_index);
308 ASSERT_TRUE(window.get()); 308 ASSERT_TRUE(window.get());
309 scoped_refptr<TabProxy> tab_proxy(window->GetTab(tab_index)); 309 scoped_refptr<TabProxy> tab_proxy(window->GetTab(tab_index));
310 ASSERT_TRUE(tab_proxy.get()); 310 ASSERT_TRUE(tab_proxy.get());
311 EXPECT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, 311 EXPECT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS,
312 tab_proxy->NavigateToURLBlockUntilNavigationsComplete( 312 tab_proxy->NavigateToURLBlockUntilNavigationsComplete(
313 url, number_of_navigations)) << url.spec(); 313 url, number_of_navigations)) << url.spec();
314 } 314 }
315 315
316 bool UITestBase::WaitForBookmarkBarVisibilityChange(BrowserProxy* browser,
317 bool wait_for_open) {
318 const int kCycles = 10;
319 const TimeDelta kDelay = TestTimeouts::action_timeout() / kCycles;
320 for (int i = 0; i < kCycles; i++) {
321 bool visible = false;
322 bool animating = true;
323 bool detached;
324 if (!browser->GetBookmarkBarVisibility(&visible, &animating, &detached))
325 return false; // Some error.
326 if (visible == wait_for_open && !animating)
327 return true; // Bookmark bar visibility change complete.
328
329 // Give it a chance to catch up.
330 base::PlatformThread::Sleep(kDelay);
331 }
332
333 ADD_FAILURE() << "Timeout reached in WaitForBookmarkBarVisibilityChange";
334 return false;
335 }
336
337 GURL UITestBase::GetActiveTabURL(int window_index) { 316 GURL UITestBase::GetActiveTabURL(int window_index) {
338 scoped_refptr<TabProxy> tab_proxy(GetActiveTab(window_index)); 317 scoped_refptr<TabProxy> tab_proxy(GetActiveTab(window_index));
339 EXPECT_TRUE(tab_proxy.get()); 318 EXPECT_TRUE(tab_proxy.get());
340 if (!tab_proxy.get()) 319 if (!tab_proxy.get())
341 return GURL(); 320 return GURL();
342 321
343 GURL url; 322 GURL url;
344 bool success = tab_proxy->GetCurrentURL(&url); 323 bool success = tab_proxy->GetCurrentURL(&url);
345 EXPECT_TRUE(success); 324 EXPECT_TRUE(success);
346 if (!success) 325 if (!success)
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
737 &session_end_completed)); 716 &session_end_completed));
738 ASSERT_TRUE(session_end_completed); 717 ASSERT_TRUE(session_end_completed);
739 718
740 // Make sure session restore says we didn't crash. 719 // Make sure session restore says we didn't crash.
741 scoped_ptr<DictionaryValue> profile_prefs(GetDefaultProfilePreferences()); 720 scoped_ptr<DictionaryValue> profile_prefs(GetDefaultProfilePreferences());
742 ASSERT_TRUE(profile_prefs.get()); 721 ASSERT_TRUE(profile_prefs.get());
743 ASSERT_TRUE(profile_prefs->GetBoolean(prefs::kSessionExitedCleanly, 722 ASSERT_TRUE(profile_prefs->GetBoolean(prefs::kSessionExitedCleanly,
744 &exited_cleanly)); 723 &exited_cleanly));
745 ASSERT_TRUE(exited_cleanly); 724 ASSERT_TRUE(exited_cleanly);
746 } 725 }
OLDNEW
« no previous file with comments | « chrome/test/ui/ui_test.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698