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

Unified Diff: chrome/test/automated_ui_tests/automated_ui_test_test.cc

Issue 196096: First part of automated_ui_tests improvements.... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: disable on lin/mac Created 11 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: chrome/test/automated_ui_tests/automated_ui_test_test.cc
diff --git a/chrome/test/automated_ui_tests/automated_ui_test_test.cc b/chrome/test/automated_ui_tests/automated_ui_test_test.cc
index 383a1e7f494110f51f0d50a79369142e8ae99ebf..a78c4468435f70cd26846e6c0f765475358caacb 100644
--- a/chrome/test/automated_ui_tests/automated_ui_test_test.cc
+++ b/chrome/test/automated_ui_tests/automated_ui_test_test.cc
@@ -3,6 +3,7 @@
// found in the LICENSE file.
#include "chrome/app/chrome_dll_resource.h"
+#include "chrome/common/url_constants.h"
#include "chrome/test/automated_ui_tests/automated_ui_test_base.h"
#include "chrome/test/automation/browser_proxy.h"
#include "chrome/test/automation/tab_proxy.h"
@@ -32,6 +33,39 @@
#define MAYBE_CloseBrowserWindow CloseBrowserWindow
#endif
+// Automation pieces are not implemented for these on platforms other than
+// Windows.
+#if defined(OS_WIN)
+#define MAYBE_FindInPage FindInPage
+#define MAYBE_ShowBookmarkBar ShowBookmarkBar
+#else
+#define MAYBE_FindInPage DISABLED_FindInPage
+#define MAYBE_ShowBookmarkBar DISABLED_ShowBookmarkBar
+#endif
+
+TEST_F(AutomatedUITestBase, MAYBE_FindInPage) {
+ ASSERT_TRUE(FindInPage());
+ bool is_visible;
+ ASSERT_TRUE(active_browser()->IsFindWindowFullyVisible(&is_visible));
+ EXPECT_TRUE(is_visible);
+}
+
+TEST_F(AutomatedUITestBase, Home) {
+ FilePath path_prefix(test_data_directory_.AppendASCII("session_history"));
+ GURL bot1(net::FilePathToFileURL(path_prefix.AppendASCII("bot1.html")));
+ NavigateToURL(bot1); // To help verify that Home does something.
+
+ ASSERT_TRUE(Home());
+
+ GURL url;
+ ASSERT_TRUE(active_browser()->GetActiveTab()->GetCurrentURL(&url));
+ EXPECT_EQ(GURL(chrome::kAboutBlankURL), url);
+
+ std::wstring title;
+ ASSERT_TRUE(active_browser()->GetActiveTab()->GetTabTitle(&title));
+ EXPECT_EQ(L"", title);
+}
+
TEST_F(AutomatedUITestBase, NewTab) {
int tab_count;
active_browser()->GetTabCount(&tab_count);
@@ -294,3 +328,72 @@ TEST_F(AutomatedUITestBase, Navigate) {
ASSERT_TRUE(GetActiveTab()->GetCurrentURL(&url));
ASSERT_EQ(url2, url);
}
+
+TEST_F(AutomatedUITestBase, SelectTab) {
+ FilePath filename(test_data_directory_);
+ filename = filename.AppendASCII("title2.html");
+ GURL url = net::FilePathToFileURL(filename);
+
+ ASSERT_TRUE(active_browser()->AppendTab(url));
+ ASSERT_TRUE(active_browser()->AppendTab(url));
+
+ int active_tab_index;
+ ASSERT_TRUE(active_browser()->GetActiveTabIndex(&active_tab_index));
+ ASSERT_EQ(2, active_tab_index);
+
+ ASSERT_TRUE(SelectNextTab());
+ ASSERT_TRUE(active_browser()->GetActiveTabIndex(&active_tab_index));
+ ASSERT_EQ(0, active_tab_index);
+
+ ASSERT_TRUE(SelectNextTab());
+ ASSERT_TRUE(active_browser()->GetActiveTabIndex(&active_tab_index));
+ ASSERT_EQ(1, active_tab_index);
+
+ ASSERT_TRUE(SelectPreviousTab());
+ ASSERT_TRUE(active_browser()->GetActiveTabIndex(&active_tab_index));
+ ASSERT_EQ(0, active_tab_index);
+
+ ASSERT_TRUE(SelectPreviousTab());
+ ASSERT_TRUE(active_browser()->GetActiveTabIndex(&active_tab_index));
+ ASSERT_EQ(2, active_tab_index);
+
+ ASSERT_TRUE(SelectPreviousTab());
+ ASSERT_TRUE(active_browser()->GetActiveTabIndex(&active_tab_index));
+ ASSERT_EQ(1, active_tab_index);
+
+ ASSERT_TRUE(SelectNextTab());
+ ASSERT_TRUE(active_browser()->GetActiveTabIndex(&active_tab_index));
+ ASSERT_EQ(2, active_tab_index);
+}
+
+TEST_F(AutomatedUITestBase, MAYBE_ShowBookmarkBar) {
+ ASSERT_TRUE(ShowBookmarkBar());
+ bool is_visible;
+ bool is_animating;
+ ASSERT_TRUE(active_browser()->GetBookmarkBarVisibility(&is_visible,
+ &is_animating));
+ ASSERT_TRUE(is_visible);
+ ASSERT_FALSE(is_animating);
+
+ // Try second time to make sure it won't make the bookmark bar
+ // disappear.
+ ASSERT_TRUE(ShowBookmarkBar());
+ ASSERT_TRUE(active_browser()->GetBookmarkBarVisibility(&is_visible,
+ &is_animating));
+ ASSERT_TRUE(is_visible);
+ ASSERT_FALSE(is_animating);
+}
+
+TEST_F(AutomatedUITestBase, ShowDownloads) {
+ ASSERT_TRUE(ShowDownloads());
+ GURL url;
+ ASSERT_TRUE(GetActiveTab()->GetCurrentURL(&url));
+ ASSERT_EQ(GURL(chrome::kChromeUIDownloadsURL), url);
+}
+
+TEST_F(AutomatedUITestBase, ShowHistory) {
+ ASSERT_TRUE(ShowHistory());
+ GURL url;
+ ASSERT_TRUE(GetActiveTab()->GetCurrentURL(&url));
+ ASSERT_EQ(GURL(chrome::kChromeUIHistoryURL), url);
+}
« no previous file with comments | « chrome/test/automated_ui_tests/automated_ui_test_base.cc ('k') | chrome/test/automated_ui_tests/automated_ui_tests.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698