summaryrefslogtreecommitdiffstats
path: root/chrome/browser/browser_browsertest.cc
diff options
context:
space:
mode:
authorphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-10 19:33:18 +0000
committerphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-10 19:33:18 +0000
commita1d5396ed9f2101d021031675eab55aafb3a2894 (patch)
tree256d3e518348bbc962075591a9922720422f3dd8 /chrome/browser/browser_browsertest.cc
parent7a2a9ce8a5fd79c2fbb5bf3db7a7d58bbd73ce80 (diff)
downloadchromium_src-a1d5396ed9f2101d021031675eab55aafb3a2894.zip
chromium_src-a1d5396ed9f2101d021031675eab55aafb3a2894.tar.gz
chromium_src-a1d5396ed9f2101d021031675eab55aafb3a2894.tar.bz2
Convert JavascriptAlertActivatesTab to browser_tests framework.
This should make it non-flaky, so I un-disabled the test. I also added necessary plumbing so we can wait for AppModalDialog to appear and close it. TEST=Covered by browser_tests. http://crbug.com/16062 Review URL: http://codereview.chromium.org/149460 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@20400 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/browser_browsertest.cc')
-rw-r--r--chrome/browser/browser_browsertest.cc19
1 files changed, 19 insertions, 0 deletions
diff --git a/chrome/browser/browser_browsertest.cc b/chrome/browser/browser_browsertest.cc
index 69ef1b8..f209837 100644
--- a/chrome/browser/browser_browsertest.cc
+++ b/chrome/browser/browser_browsertest.cc
@@ -5,9 +5,11 @@
#include <string>
#include "app/l10n_util.h"
+#include "chrome/browser/app_modal_dialog.h"
#include "chrome/browser/browser.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/tab_contents/tab_contents.h"
+#include "chrome/common/page_transition_types.h"
#include "chrome/test/in_process_browser_test.h"
#include "chrome/test/ui_test_utils.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -79,3 +81,20 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, Title) {
ASSERT_TRUE(ui_test_utils::GetCurrentTabTitle(browser(), &tab_title));
EXPECT_EQ(WideToUTF16(test_title), tab_title);
}
+
+IN_PROC_BROWSER_TEST_F(BrowserTest, JavascriptAlertActivatesTab) {
+ GURL url(ui_test_utils::GetTestUrl(L".", L"title1.html"));
+ ui_test_utils::NavigateToURL(browser(), url);
+ browser()->AddTabWithURL(url, GURL(), PageTransition::TYPED,
+ true, 0, false, NULL);
+ EXPECT_EQ(2, browser()->tab_count());
+ EXPECT_EQ(0, browser()->selected_index());
+ TabContents* second_tab = browser()->GetTabContentsAt(1);
+ ASSERT_TRUE(second_tab);
+ second_tab->render_view_host()->ExecuteJavascriptInWebFrame(L"",
+ L"alert('Activate!');");
+ AppModalDialog* alert = ui_test_utils::WaitForAppModalDialog();
+ alert->CloseModalDialog();
+ EXPECT_EQ(2, browser()->tab_count());
+ EXPECT_EQ(1, browser()->selected_index());
+}