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

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

Issue 10388175: Remove all the unnused automation IPCs. These were used by UI tests that have been converted to bro… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 7 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 401 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 412
413 ADD_FAILURE() << "Timeout reached in WaitUntilTabCount"; 413 ADD_FAILURE() << "Timeout reached in WaitUntilTabCount";
414 } 414 }
415 415
416 const FilePath::CharType* UITestBase::GetExecutablePath() { 416 const FilePath::CharType* UITestBase::GetExecutablePath() {
417 if (launch_arguments_.HasSwitch(switches::kEnableChromiumBranding)) 417 if (launch_arguments_.HasSwitch(switches::kEnableChromiumBranding))
418 return chrome::kBrowserProcessExecutablePathChromium; 418 return chrome::kBrowserProcessExecutablePathChromium;
419 return chrome::kBrowserProcessExecutablePath; 419 return chrome::kBrowserProcessExecutablePath;
420 } 420 }
421 421
422 void UITestBase::CloseBrowserAsync(BrowserProxy* browser) const {
423 ASSERT_TRUE(automation()->Send(
424 new AutomationMsg_CloseBrowserRequestAsync(browser->handle())));
425 }
426
427 bool UITestBase::CloseBrowser(BrowserProxy* browser, 422 bool UITestBase::CloseBrowser(BrowserProxy* browser,
428 bool* application_closed) const { 423 bool* application_closed) const {
429 DCHECK(application_closed); 424 DCHECK(application_closed);
430 if (!browser->is_valid() || !browser->handle()) 425 if (!browser->is_valid() || !browser->handle())
431 return false; 426 return false;
432 427
433 bool result = true; 428 bool result = true;
434 429
435 bool succeeded = automation()->Send(new AutomationMsg_CloseBrowser( 430 bool succeeded = automation()->Send(new AutomationMsg_CloseBrowser(
436 browser->handle(), &result, application_closed)); 431 browser->handle(), &result, application_closed));
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
661 if (!cookie_value.empty()) 656 if (!cookie_value.empty())
662 return cookie_value; 657 return cookie_value;
663 658
664 base::PlatformThread::Sleep(kDelay); 659 base::PlatformThread::Sleep(kDelay);
665 } 660 }
666 661
667 ADD_FAILURE() << "Timeout reached in WaitUntilCookieNonEmpty"; 662 ADD_FAILURE() << "Timeout reached in WaitUntilCookieNonEmpty";
668 return std::string(); 663 return std::string();
669 } 664 }
670 665
671 bool UITest::WaitForDownloadShelfVisible(BrowserProxy* browser) {
672 return WaitForDownloadShelfVisibilityChange(browser, true);
673 }
674
675 bool UITest::WaitForDownloadShelfInvisible(BrowserProxy* browser) {
676 return WaitForDownloadShelfVisibilityChange(browser, false);
677 }
678
679 bool UITest::WaitForFindWindowVisibilityChange(BrowserProxy* browser, 666 bool UITest::WaitForFindWindowVisibilityChange(BrowserProxy* browser,
680 bool wait_for_open) { 667 bool wait_for_open) {
681 const int kCycles = 10; 668 const int kCycles = 10;
682 const TimeDelta kDelay = TestTimeouts::action_timeout() / kCycles; 669 const TimeDelta kDelay = TestTimeouts::action_timeout() / kCycles;
683 for (int i = 0; i < kCycles; i++) { 670 for (int i = 0; i < kCycles; i++) {
684 bool visible = false; 671 bool visible = false;
685 if (!browser->IsFindWindowFullyVisible(&visible)) 672 if (!browser->IsFindWindowFullyVisible(&visible))
686 return false; // Some error. 673 return false; // Some error.
687 if (visible == wait_for_open) 674 if (visible == wait_for_open)
688 return true; // Find window visibility change complete. 675 return true; // Find window visibility change complete.
(...skipping 24 matching lines...) Expand all
713 ASSERT_TRUE(session_end_completed); 700 ASSERT_TRUE(session_end_completed);
714 701
715 // Make sure session restore says we didn't crash. 702 // Make sure session restore says we didn't crash.
716 scoped_ptr<DictionaryValue> profile_prefs(GetDefaultProfilePreferences()); 703 scoped_ptr<DictionaryValue> profile_prefs(GetDefaultProfilePreferences());
717 ASSERT_TRUE(profile_prefs.get()); 704 ASSERT_TRUE(profile_prefs.get());
718 ASSERT_TRUE(profile_prefs->GetBoolean(prefs::kSessionExitedCleanly, 705 ASSERT_TRUE(profile_prefs->GetBoolean(prefs::kSessionExitedCleanly,
719 &exited_cleanly)); 706 &exited_cleanly));
720 ASSERT_TRUE(exited_cleanly); 707 ASSERT_TRUE(exited_cleanly);
721 } 708 }
722 709
723 void UITest::NavigateToURLAsync(const GURL& url) {
724 scoped_refptr<TabProxy> tab_proxy(GetActiveTab());
725 ASSERT_TRUE(tab_proxy.get());
726 ASSERT_TRUE(tab_proxy->NavigateToURLAsync(url));
727 }
728
729 bool UITest::WaitForDownloadShelfVisibilityChange(BrowserProxy* browser,
730 bool wait_for_open) {
731 const int kCycles = 10;
732 const TimeDelta kDelay = TestTimeouts::action_timeout() / kCycles;
733 int fail_count = 0;
734 int incorrect_state_count = 0;
735 base::Time start = base::Time::Now();
736 for (int i = 0; i < kCycles; i++) {
737 bool visible = !wait_for_open;
738 if (!browser->IsShelfVisible(&visible)) {
739 fail_count++;
740 continue;
741 }
742 if (visible == wait_for_open) {
743 LOG(INFO) << "Elapsed time: " << (base::Time::Now() - start).InSecondsF()
744 << " seconds"
745 << " call failed " << fail_count << " times"
746 << " state was incorrect " << incorrect_state_count << " times";
747 return true; // Got the download shelf.
748 }
749 incorrect_state_count++;
750
751 // Give it a chance to catch up.
752 base::PlatformThread::Sleep(kDelay);
753 }
754
755 LOG(INFO) << "Elapsed time: " << (base::Time::Now() - start).InSecondsF()
756 << " seconds"
757 << " call failed " << fail_count << " times"
758 << " state was incorrect " << incorrect_state_count << " times";
759 ADD_FAILURE() << "Timeout reached in " << __FUNCTION__;
760 return false;
761 }
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