summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-29 18:45:44 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-29 18:45:44 +0000
commit895a8472bdc74bcaa0c32609f68c6570dedba03e (patch)
tree36b36b3e13d0c1e475a4357874f89f41c9d0a23e /chrome/browser
parent57b531b405a961a7af36a54b9956c5514212ac53 (diff)
downloadchromium_src-895a8472bdc74bcaa0c32609f68c6570dedba03e.zip
chromium_src-895a8472bdc74bcaa0c32609f68c6570dedba03e.tar.gz
chromium_src-895a8472bdc74bcaa0c32609f68c6570dedba03e.tar.bz2
Move the test functions that deal with focus to interactive_ui_tets_utils.h and into the interactive_ui_tests target. That way they can't be misused from browser_tests.
Review URL: https://codereview.chromium.org/11414223 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@170224 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/autofill/autofill_browsertest.cc8
-rw-r--r--chrome/browser/browser_keyevents_browsertest.cc1
-rw-r--r--chrome/browser/chromeos/login/login_browsertest.cc1
-rw-r--r--chrome/browser/extensions/api/tabs/tabs_interactive_test.cc58
-rw-r--r--chrome/browser/extensions/api/tabs/tabs_test.cc56
-rw-r--r--chrome/browser/extensions/extension_keybinding_apitest.cc1
-rw-r--r--chrome/browser/instant/instant_browsertest.cc1
-rw-r--r--chrome/browser/ui/browser_focus_uitest.cc42
-rw-r--r--chrome/browser/ui/browser_navigator_browsertest.cc41
-rw-r--r--chrome/browser/ui/cocoa/test/ui_test_utils_mac.mm93
-rw-r--r--chrome/browser/ui/fullscreen/fullscreen_controller_interactive_browsertest.cc1
-rw-r--r--chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk_interactive_uitest.cc1
-rw-r--r--chrome/browser/ui/gtk/test/ui_test_utils_gtk.cc85
-rw-r--r--chrome/browser/ui/omnibox/action_box_browsertest.cc1
-rw-r--r--chrome/browser/ui/omnibox/omnibox_view_browsertest.cc1
-rw-r--r--chrome/browser/ui/panels/base_panel_browser_test.cc1
-rw-r--r--chrome/browser/ui/panels/panel_browsertest.cc26
-rw-r--r--chrome/browser/ui/panels/panel_extension_browsertest.cc25
-rw-r--r--chrome/browser/ui/views/bookmarks/bookmark_bar_view_test.cc1
-rw-r--r--chrome/browser/ui/views/button_dropdown_test.cc1
-rw-r--r--chrome/browser/ui/views/find_bar_host_interactive_uitest.cc1
-rw-r--r--chrome/browser/ui/views/keyboard_access_browsertest.cc1
-rw-r--r--chrome/browser/ui/views/menu_item_view_test.cc1
-rw-r--r--chrome/browser/ui/views/menu_model_adapter_test.cc1
-rw-r--r--chrome/browser/ui/views/ssl_client_certificate_selector_browsertest.cc1
-rw-r--r--chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc1
-rw-r--r--chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest_win.cc1
-rw-r--r--chrome/browser/ui/views/test/ui_test_utils_aura.cc31
-rw-r--r--chrome/browser/ui/views/test/ui_test_utils_aura.h21
-rw-r--r--chrome/browser/ui/views/test/ui_test_utils_views.cc54
-rw-r--r--chrome/browser/ui/views/test/ui_test_utils_win.cc129
31 files changed, 145 insertions, 542 deletions
diff --git a/chrome/browser/autofill/autofill_browsertest.cc b/chrome/browser/autofill/autofill_browsertest.cc
index 7d6a5b3..4255985 100644
--- a/chrome/browser/autofill/autofill_browsertest.cc
+++ b/chrome/browser/autofill/autofill_browsertest.cc
@@ -450,7 +450,6 @@ IN_PROC_BROWSER_TEST_F(AutofillTest, MAYBE_AutofillViaDownArrow) {
CreateTestProfile();
// Load the test page.
- ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser()));
ASSERT_NO_FATAL_FAILURE(ui_test_utils::NavigateToURL(browser(),
GURL(std::string(kDataURIPrefix) + kTestFormString)));
@@ -507,7 +506,6 @@ IN_PROC_BROWSER_TEST_F(AutofillTest, MAYBE_OnChangeAfterAutofill) {
"</script>";
// Load the test page.
- ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser()));
ASSERT_NO_FATAL_FAILURE(ui_test_utils::NavigateToURL(browser(),
GURL(std::string(kDataURIPrefix) + kTestFormString + kOnChangeScript)));
@@ -582,7 +580,6 @@ IN_PROC_BROWSER_TEST_F(AutofillTest, DISABLED_AutofillFormsDistinguishedById) {
"newForm.id = 'newForm';"
"mainForm.parentNode.insertBefore(newForm, mainForm);"
"</script>";
- ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser()));
ASSERT_NO_FATAL_FAILURE(ui_test_utils::NavigateToURL(browser(), GURL(kURL)));
// Invoke Autofill.
@@ -598,7 +595,6 @@ IN_PROC_BROWSER_TEST_F(AutofillTest, DISABLED_AutofillFormWithRepeatedField) {
CreateTestProfile();
// Load the test page.
- ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser()));
ASSERT_NO_FATAL_FAILURE(ui_test_utils::NavigateToURL(browser(),
GURL(std::string(kDataURIPrefix) +
"<form action=\"http://www.example.com/\" method=\"POST\">"
@@ -654,7 +650,6 @@ IN_PROC_BROWSER_TEST_F(AutofillTest,
CreateTestProfile();
// Load the test page.
- ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser()));
ASSERT_NO_FATAL_FAILURE(ui_test_utils::NavigateToURL(browser(),
GURL(std::string(kDataURIPrefix) +
"<form action=\"http://www.example.com/\" method=\"POST\">"
@@ -699,7 +694,6 @@ IN_PROC_BROWSER_TEST_F(AutofillTest, DISABLED_DynamicFormFill) {
CreateTestProfile();
// Load the test page.
- ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser()));
ASSERT_NO_FATAL_FAILURE(ui_test_utils::NavigateToURL(browser(),
GURL(std::string(kDataURIPrefix) +
"<form id=\"form\" action=\"http://www.example.com/\""
@@ -798,7 +792,6 @@ IN_PROC_BROWSER_TEST_F(AutofillTest, MAYBE_AutofillAfterReload) {
// Load the test page.
LOG(WARNING) << "Bringing browser window to front.";
- ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser()));
LOG(WARNING) << "Navigating to URL.";
ASSERT_NO_FATAL_FAILURE(ui_test_utils::NavigateToURL(browser(),
GURL(std::string(kDataURIPrefix) + kTestFormString)));
@@ -849,7 +842,6 @@ IN_PROC_BROWSER_TEST_F(AutofillTest, DISABLED_AutofillAfterTranslate) {
"<label for=\"ph\">Phone number:</label>"
" <input type=\"text\" id=\"ph\"><br>"
"</form>");
- ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser()));
ASSERT_NO_FATAL_FAILURE(ui_test_utils::NavigateToURL(browser(), url));
// Get translation bar.
diff --git a/chrome/browser/browser_keyevents_browsertest.cc b/chrome/browser/browser_keyevents_browsertest.cc
index 7b6174a..5381581 100644
--- a/chrome/browser/browser_keyevents_browsertest.cc
+++ b/chrome/browser/browser_keyevents_browsertest.cc
@@ -14,6 +14,7 @@
#include "chrome/browser/ui/browser_tabstrip.h"
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/chrome_paths.h"
+#include "chrome/test/base/interactive_test_utils.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/ui_test_utils.h"
#include "content/public/browser/dom_operation_notification_details.h"
diff --git a/chrome/browser/chromeos/login/login_browsertest.cc b/chrome/browser/chromeos/login/login_browsertest.cc
index 3ae35e8..5d5993e 100644
--- a/chrome/browser/chromeos/login/login_browsertest.cc
+++ b/chrome/browser/chromeos/login/login_browsertest.cc
@@ -13,6 +13,7 @@
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/common/chrome_switches.h"
+#include "chrome/test/base/interactive_test_utils.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/ui_test_utils.h"
#include "testing/gmock/include/gmock/gmock.h"
diff --git a/chrome/browser/extensions/api/tabs/tabs_interactive_test.cc b/chrome/browser/extensions/api/tabs/tabs_interactive_test.cc
index 7114cbc..1d17ce4 100644
--- a/chrome/browser/extensions/api/tabs/tabs_interactive_test.cc
+++ b/chrome/browser/extensions/api/tabs/tabs_interactive_test.cc
@@ -9,6 +9,8 @@
#include "chrome/browser/extensions/extension_function_test_utils.h"
#include "chrome/browser/extensions/extension_tab_util.h"
#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/browser_window.h"
+#include "chrome/test/base/interactive_test_utils.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/ui_test_utils.h"
@@ -51,3 +53,59 @@ IN_PROC_BROWSER_TEST_F(ExtensionTabsTest, GetLastFocusedWindow) {
// "populate" was enabled so tabs should be populated.
EXPECT_TRUE(result.get()->GetList(keys::kTabsKey, &tabs));
}
+
+// Flaky: http://crbug.com/136562
+IN_PROC_BROWSER_TEST_F(ExtensionTabsTest, DISABLED_QueryLastFocusedWindowTabs) {
+ const size_t kExtraWindows = 2;
+ for (size_t i = 0; i < kExtraWindows; ++i)
+ CreateBrowser(browser()->profile());
+
+ Browser* focused_window = CreateBrowser(browser()->profile());
+#if defined(OS_MACOSX)
+ // See BrowserWindowCocoa::Show. In tests, Browser::window()->IsActive won't
+ // work unless we fake the browser being launched by the user.
+ ASSERT_TRUE(ui_test_utils::ShowAndFocusNativeWindow(
+ focused_window->window()->GetNativeWindow()));
+#endif
+
+ // Needed on Mac and Linux so that the BrowserWindow::IsActive calls work.
+ content::RunAllPendingInMessageLoop();
+
+ GURL url;
+ AddTabAtIndexToBrowser(focused_window, 0, url, content::PAGE_TRANSITION_LINK);
+ int focused_window_id = ExtensionTabUtil::GetWindowId(focused_window);
+
+ // Get tabs in the 'last focused' window called from non-focused browser.
+ scoped_refptr<QueryTabsFunction> function = new QueryTabsFunction();
+ scoped_ptr<base::ListValue> result(utils::ToList(
+ utils::RunFunctionAndReturnSingleResult(function.get(),
+ "[{\"lastFocusedWindow\":true}]",
+ browser())));
+
+ ListValue* result_tabs = result.get();
+ // We should have one initial tab and one added tab.
+ EXPECT_EQ(2u, result_tabs->GetSize());
+ for (size_t i = 0; i < result_tabs->GetSize(); ++i) {
+ DictionaryValue* result_tab = NULL;
+ EXPECT_TRUE(result_tabs->GetDictionary(i, &result_tab));
+ EXPECT_EQ(focused_window_id, utils::GetInteger(result_tab,
+ keys::kWindowIdKey));
+ }
+
+ // Get tabs NOT in the 'last focused' window called from the focused browser.
+ function = new QueryTabsFunction();
+ result.reset(utils::ToList(
+ utils::RunFunctionAndReturnSingleResult(function.get(),
+ "[{\"lastFocusedWindow\":false}]",
+ browser())));
+
+ result_tabs = result.get();
+ // We should get one tab for each extra window and one for the initial window.
+ EXPECT_EQ(kExtraWindows + 1, result_tabs->GetSize());
+ for (size_t i = 0; i < result_tabs->GetSize(); ++i) {
+ DictionaryValue* result_tab = NULL;
+ EXPECT_TRUE(result_tabs->GetDictionary(i, &result_tab));
+ EXPECT_NE(focused_window_id, utils::GetInteger(result_tab,
+ keys::kWindowIdKey));
+ }
+}
diff --git a/chrome/browser/extensions/api/tabs/tabs_test.cc b/chrome/browser/extensions/api/tabs/tabs_test.cc
index 49ba37c..e04d5cf 100644
--- a/chrome/browser/extensions/api/tabs/tabs_test.cc
+++ b/chrome/browser/extensions/api/tabs/tabs_test.cc
@@ -439,62 +439,6 @@ IN_PROC_BROWSER_TEST_F(ExtensionTabsTest, QueryCurrentWindowTabs) {
}
}
-// Flaky: http://crbug.com/136562
-IN_PROC_BROWSER_TEST_F(ExtensionTabsTest, DISABLED_QueryLastFocusedWindowTabs) {
- const size_t kExtraWindows = 2;
- for (size_t i = 0; i < kExtraWindows; ++i)
- CreateBrowser(browser()->profile());
-
- Browser* focused_window = CreateBrowser(browser()->profile());
-#if defined(OS_MACOSX)
- // See BrowserWindowCocoa::Show. In tests, Browser::window()->IsActive won't
- // work unless we fake the browser being launched by the user.
- ASSERT_TRUE(ui_test_utils::ShowAndFocusNativeWindow(
- focused_window->window()->GetNativeWindow()));
-#endif
-
- // Needed on Mac and Linux so that the BrowserWindow::IsActive calls work.
- content::RunAllPendingInMessageLoop();
-
- GURL url;
- AddTabAtIndexToBrowser(focused_window, 0, url, content::PAGE_TRANSITION_LINK);
- int focused_window_id = ExtensionTabUtil::GetWindowId(focused_window);
-
- // Get tabs in the 'last focused' window called from non-focused browser.
- scoped_refptr<QueryTabsFunction> function = new QueryTabsFunction();
- scoped_ptr<base::ListValue> result(utils::ToList(
- utils::RunFunctionAndReturnSingleResult(function.get(),
- "[{\"lastFocusedWindow\":true}]",
- browser())));
-
- ListValue* result_tabs = result.get();
- // We should have one initial tab and one added tab.
- EXPECT_EQ(2u, result_tabs->GetSize());
- for (size_t i = 0; i < result_tabs->GetSize(); ++i) {
- DictionaryValue* result_tab = NULL;
- EXPECT_TRUE(result_tabs->GetDictionary(i, &result_tab));
- EXPECT_EQ(focused_window_id, utils::GetInteger(result_tab,
- keys::kWindowIdKey));
- }
-
- // Get tabs NOT in the 'last focused' window called from the focused browser.
- function = new QueryTabsFunction();
- result.reset(utils::ToList(
- utils::RunFunctionAndReturnSingleResult(function.get(),
- "[{\"lastFocusedWindow\":false}]",
- browser())));
-
- result_tabs = result.get();
- // We should get one tab for each extra window and one for the initial window.
- EXPECT_EQ(kExtraWindows + 1, result_tabs->GetSize());
- for (size_t i = 0; i < result_tabs->GetSize(); ++i) {
- DictionaryValue* result_tab = NULL;
- EXPECT_TRUE(result_tabs->GetDictionary(i, &result_tab));
- EXPECT_NE(focused_window_id, utils::GetInteger(result_tab,
- keys::kWindowIdKey));
- }
-}
-
IN_PROC_BROWSER_TEST_F(ExtensionTabsTest, DontCreateTabInClosingPopupWindow) {
// Test creates new popup window, closes it right away and then tries to open
// a new tab in it. Tab should not be opened in the popup window, but in a
diff --git a/chrome/browser/extensions/extension_keybinding_apitest.cc b/chrome/browser/extensions/extension_keybinding_apitest.cc
index 3fe9591..927edb0 100644
--- a/chrome/browser/extensions/extension_keybinding_apitest.cc
+++ b/chrome/browser/extensions/extension_keybinding_apitest.cc
@@ -15,6 +15,7 @@
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/extensions/extension.h"
+#include "chrome/test/base/interactive_test_utils.h"
#include "chrome/test/base/ui_test_utils.h"
#include "content/public/browser/notification_service.h"
#include "content/public/browser/web_contents.h"
diff --git a/chrome/browser/instant/instant_browsertest.cc b/chrome/browser/instant/instant_browsertest.cc
index e4e5c5d..e85d755 100644
--- a/chrome/browser/instant/instant_browsertest.cc
+++ b/chrome/browser/instant/instant_browsertest.cc
@@ -21,6 +21,7 @@
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/pref_names.h"
+#include "chrome/test/base/interactive_test_utils.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/ui_test_utils.h"
#include "content/public/browser/notification_service.h"
diff --git a/chrome/browser/ui/browser_focus_uitest.cc b/chrome/browser/ui/browser_focus_uitest.cc
index 1a4fb90..7726fd0 100644
--- a/chrome/browser/ui/browser_focus_uitest.cc
+++ b/chrome/browser/ui/browser_focus_uitest.cc
@@ -17,12 +17,17 @@
#include "chrome/browser/ui/browser_tabstrip.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/chrome_pages.h"
+#include "chrome/browser/ui/omnibox/location_bar.h"
+#include "chrome/browser/ui/omnibox/omnibox_edit_controller.h"
+#include "chrome/browser/ui/omnibox/omnibox_edit_model.h"
+#include "chrome/browser/ui/omnibox/omnibox_view.h"
#include "chrome/browser/ui/tab_contents/tab_contents.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/browser/ui/view_ids.h"
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/url_constants.h"
+#include "chrome/test/base/interactive_test_utils.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/ui_test_utils.h"
#include "content/public/browser/interstitial_page.h"
@@ -922,4 +927,41 @@ IN_PROC_BROWSER_TEST_F(BrowserFocusTest, DISABLED_FocusOnReloadCrashedTab) {
ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER));
}
+// Tests that when a new tab is opened from the omnibox, the focus is moved from
+// the omnibox for the current tab.
+IN_PROC_BROWSER_TEST_F(BrowserFocusTest,
+ NavigateFromOmniboxIntoNewTab) {
+ GURL url("http://www.google.com/");
+ GURL url2("http://maps.google.com/");
+
+ // Navigate to url.
+ chrome::NavigateParams p(browser(), url, content::PAGE_TRANSITION_LINK);
+ p.window_action = chrome::NavigateParams::SHOW_WINDOW;
+ p.disposition = CURRENT_TAB;
+ chrome::Navigate(&p);
+
+ // Focus the omnibox.
+ chrome::FocusLocationBar(browser());
+
+ OmniboxEditController* controller =
+ browser()->window()->GetLocationBar()->GetLocationEntry()->model()->
+ controller();
+
+ // Simulate an alt-enter.
+ controller->OnAutocompleteAccept(url2, NEW_FOREGROUND_TAB,
+ content::PAGE_TRANSITION_TYPED, GURL());
+
+ // Make sure the second tab is selected.
+ EXPECT_EQ(1, browser()->active_index());
+
+ // The tab contents should have the focus in the second tab.
+ EXPECT_TRUE(ui_test_utils::IsViewFocused(browser(), VIEW_ID_TAB_CONTAINER));
+
+ // Go back to the first tab. The focus should not be in the omnibox.
+ chrome::SelectPreviousTab(browser());
+ EXPECT_EQ(0, browser()->active_index());
+ EXPECT_FALSE(ui_test_utils::IsViewFocused(browser(),
+ VIEW_ID_LOCATION_BAR));
+}
+
} // namespace
diff --git a/chrome/browser/ui/browser_navigator_browsertest.cc b/chrome/browser/ui/browser_navigator_browsertest.cc
index fe030ae..9577116 100644
--- a/chrome/browser/ui/browser_navigator_browsertest.cc
+++ b/chrome/browser/ui/browser_navigator_browsertest.cc
@@ -15,10 +15,6 @@
#include "chrome/browser/ui/browser_tabstrip.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/chrome_pages.h"
-#include "chrome/browser/ui/omnibox/location_bar.h"
-#include "chrome/browser/ui/omnibox/omnibox_edit_controller.h"
-#include "chrome/browser/ui/omnibox/omnibox_edit_model.h"
-#include "chrome/browser/ui/omnibox/omnibox_view.h"
#include "chrome/browser/ui/tab_contents/tab_contents.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/common/chrome_switches.h"
@@ -1161,43 +1157,6 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
ShortenUberURL(chrome::GetActiveWebContents(browser())->GetURL()));
}
-// Tests that when a new tab is opened from the omnibox, the focus is moved from
-// the omnibox for the current tab.
-IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
- NavigateFromOmniboxIntoNewTab) {
- GURL url("http://www.google.com/");
- GURL url2("http://maps.google.com/");
-
- // Navigate to url.
- chrome::NavigateParams p(MakeNavigateParams());
- p.disposition = CURRENT_TAB;
- p.url = url;
- chrome::Navigate(&p);
-
- // Focus the omnibox.
- chrome::FocusLocationBar(browser());
-
- OmniboxEditController* controller =
- browser()->window()->GetLocationBar()->GetLocationEntry()->model()->
- controller();
-
- // Simulate an alt-enter.
- controller->OnAutocompleteAccept(url2, NEW_FOREGROUND_TAB,
- content::PAGE_TRANSITION_TYPED, GURL());
-
- // Make sure the second tab is selected.
- EXPECT_EQ(1, browser()->active_index());
-
- // The tab contents should have the focus in the second tab.
- EXPECT_TRUE(ui_test_utils::IsViewFocused(browser(), VIEW_ID_TAB_CONTAINER));
-
- // Go back to the first tab. The focus should not be in the omnibox.
- chrome::SelectPreviousTab(browser());
- EXPECT_EQ(0, browser()->active_index());
- EXPECT_FALSE(ui_test_utils::IsViewFocused(browser(),
- VIEW_ID_LOCATION_BAR));
-}
-
// TODO(csilv): Update this for uber page. http://crbug.com/111579.
IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
DISABLED_NavigateFromDefaultToHistoryInSameTab) {
diff --git a/chrome/browser/ui/cocoa/test/ui_test_utils_mac.mm b/chrome/browser/ui/cocoa/test/ui_test_utils_mac.mm
deleted file mode 100644
index 706fbd2..0000000
--- a/chrome/browser/ui/cocoa/test/ui_test_utils_mac.mm
+++ /dev/null
@@ -1,93 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/test/base/ui_test_utils.h"
-
-#include <Carbon/Carbon.h>
-#import <Cocoa/Cocoa.h>
-
-#include "base/bind.h"
-#include "base/logging.h"
-#include "base/message_loop.h"
-#include "chrome/browser/ui/browser.h"
-#include "chrome/browser/ui/browser_window.h"
-#include "ui/ui_controls/ui_controls.h"
-#import "chrome/browser/ui/cocoa/view_id_util.h"
-
-namespace ui_test_utils {
-
-bool IsViewFocused(const Browser* browser, ViewID vid) {
- NSWindow* window = browser->window()->GetNativeWindow();
- DCHECK(window);
- NSView* view = view_id_util::GetView(window, vid);
- if (!view)
- return false;
-
- NSResponder* firstResponder = [window firstResponder];
- if (firstResponder == static_cast<NSResponder*>(view))
- return true;
-
- // Handle the special case of focusing a TextField.
- if ([firstResponder isKindOfClass:[NSTextView class]]) {
- NSView* delegate = static_cast<NSView*>([(NSTextView*)firstResponder
- delegate]);
- if (delegate == view)
- return true;
- }
-
- return false;
-}
-
-void ClickOnView(const Browser* browser, ViewID vid) {
- NSWindow* window = browser->window()->GetNativeWindow();
- DCHECK(window);
- NSView* view = view_id_util::GetView(window, vid);
- DCHECK(view);
- MoveMouseToCenterAndPress(
- view,
- ui_controls::LEFT,
- ui_controls::DOWN | ui_controls::UP,
- MessageLoop::QuitClosure());
- content::RunMessageLoop();
-}
-
-void HideNativeWindow(gfx::NativeWindow window) {
- [window orderOut:nil];
-}
-
-bool ShowAndFocusNativeWindow(gfx::NativeWindow window) {
- // Make sure an unbundled program can get the input focus.
- ProcessSerialNumber psn = { 0, kCurrentProcess };
- TransformProcessType(&psn,kProcessTransformToForegroundApplication);
- SetFrontProcess(&psn);
-
- [window makeKeyAndOrderFront:nil];
- return true;
-}
-
-void MoveMouseToCenterAndPress(
- NSView* view,
- ui_controls::MouseButton button,
- int state,
- const base::Closure& task) {
- DCHECK(view);
- NSWindow* window = [view window];
- DCHECK(window);
- NSScreen* screen = [window screen];
- DCHECK(screen);
-
- // Converts the center position of the view into the coordinates accepted
- // by SendMouseMoveNotifyWhenDone() method.
- NSRect bounds = [view bounds];
- NSPoint center = NSMakePoint(NSMidX(bounds), NSMidY(bounds));
- center = [view convertPoint:center toView:nil];
- center = [window convertBaseToScreen:center];
- center = NSMakePoint(center.x, [screen frame].size.height - center.y);
-
- ui_controls::SendMouseMoveNotifyWhenDone(
- center.x, center.y,
- base::Bind(&internal::ClickTask, button, state, task));
-}
-
-} // namespace ui_test_utils
diff --git a/chrome/browser/ui/fullscreen/fullscreen_controller_interactive_browsertest.cc b/chrome/browser/ui/fullscreen/fullscreen_controller_interactive_browsertest.cc
index 6903928..85c2b772 100644
--- a/chrome/browser/ui/fullscreen/fullscreen_controller_interactive_browsertest.cc
+++ b/chrome/browser/ui/fullscreen/fullscreen_controller_interactive_browsertest.cc
@@ -10,6 +10,7 @@
#include "chrome/browser/ui/browser_tabstrip.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/fullscreen/fullscreen_controller_test.h"
+#include "chrome/test/base/interactive_test_utils.h"
#include "chrome/test/base/ui_test_utils.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/render_widget_host_view.h"
diff --git a/chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk_interactive_uitest.cc b/chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk_interactive_uitest.cc
index 5739c6e..a7151a5 100644
--- a/chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk_interactive_uitest.cc
+++ b/chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk_interactive_uitest.cc
@@ -10,6 +10,7 @@
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/gtk/view_id_util.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
+#include "chrome/test/base/interactive_test_utils.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/ui_test_utils.h"
#include "net/test/test_server.h"
diff --git a/chrome/browser/ui/gtk/test/ui_test_utils_gtk.cc b/chrome/browser/ui/gtk/test/ui_test_utils_gtk.cc
deleted file mode 100644
index d493447..0000000
--- a/chrome/browser/ui/gtk/test/ui_test_utils_gtk.cc
+++ /dev/null
@@ -1,85 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/test/base/ui_test_utils.h"
-
-#include <gtk/gtk.h>
-
-#include "base/bind.h"
-#include "base/logging.h"
-#include "base/message_loop.h"
-#include "chrome/browser/ui/browser.h"
-#include "chrome/browser/ui/browser_window.h"
-#include "chrome/browser/ui/gtk/view_id_util.h"
-#include "ui/base/gtk/gtk_screen_util.h"
-#include "ui/ui_controls/ui_controls.h"
-
-namespace ui_test_utils {
-
-namespace {
-// Check if the focused widget for |root| is |target| or a child of |target|.
-static bool IsWidgetInFocusChain(GtkWidget* root, GtkWidget* target) {
- GtkWidget* iter = root;
-
- while (iter) {
- if (iter == target)
- return true;
-
- if (!GTK_IS_CONTAINER(iter))
- return false;
-
- iter = GTK_CONTAINER(iter)->focus_child;
- }
-
- return false;
-}
-} // namespace
-
-bool IsViewFocused(const Browser* browser, ViewID vid) {
- BrowserWindow* browser_window = browser->window();
- DCHECK(browser_window);
- gfx::NativeWindow window = browser_window->GetNativeWindow();
- DCHECK(window);
- GtkWidget* widget = ViewIDUtil::GetWidget(GTK_WIDGET(window), vid);
- DCHECK(widget);
- return IsWidgetInFocusChain(GTK_WIDGET(window), widget);
-}
-
-void ClickOnView(const Browser* browser, ViewID vid) {
- BrowserWindow* browser_window = browser->window();
- DCHECK(browser_window);
- gfx::NativeWindow window = browser_window->GetNativeWindow();
- DCHECK(window);
- GtkWidget* view = ViewIDUtil::GetWidget(GTK_WIDGET(window), vid);
- DCHECK(view);
- MoveMouseToCenterAndPress(
- view,
- ui_controls::LEFT,
- ui_controls::DOWN | ui_controls::UP,
- MessageLoop::QuitClosure());
- content::RunMessageLoop();
-}
-
-void HideNativeWindow(gfx::NativeWindow window) {
- gtk_widget_hide(GTK_WIDGET(window));
-}
-
-bool ShowAndFocusNativeWindow(gfx::NativeWindow window) {
- if (!gtk_window_has_toplevel_focus(GTK_WINDOW(window)))
- gtk_window_present(GTK_WINDOW(window));
- return true;
-}
-
-void MoveMouseToCenterAndPress(GtkWidget* widget,
- ui_controls::MouseButton button,
- int state,
- const base::Closure& task) {
- gfx::Rect bounds = ui::GetWidgetScreenBounds(widget);
- ui_controls::SendMouseMoveNotifyWhenDone(
- bounds.x() + bounds.width() / 2,
- bounds.y() + bounds.height() / 2,
- base::Bind(&internal::ClickTask, button, state, task));
-}
-
-} // namespace ui_test_utils
diff --git a/chrome/browser/ui/omnibox/action_box_browsertest.cc b/chrome/browser/ui/omnibox/action_box_browsertest.cc
index 6e2c1f8..e2310f6 100644
--- a/chrome/browser/ui/omnibox/action_box_browsertest.cc
+++ b/chrome/browser/ui/omnibox/action_box_browsertest.cc
@@ -20,6 +20,7 @@
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/url_constants.h"
+#include "chrome/test/base/interactive_test_utils.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/testing_profile.h"
#include "chrome/test/base/ui_test_utils.h"
diff --git a/chrome/browser/ui/omnibox/omnibox_view_browsertest.cc b/chrome/browser/ui/omnibox/omnibox_view_browsertest.cc
index c967a3a..805abbd 100644
--- a/chrome/browser/ui/omnibox/omnibox_view_browsertest.cc
+++ b/chrome/browser/ui/omnibox/omnibox_view_browsertest.cc
@@ -31,6 +31,7 @@
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/url_constants.h"
+#include "chrome/test/base/interactive_test_utils.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/ui_test_utils.h"
#include "content/public/browser/notification_service.h"
diff --git a/chrome/browser/ui/panels/base_panel_browser_test.cc b/chrome/browser/ui/panels/base_panel_browser_test.cc
index 3276240..57c0023 100644
--- a/chrome/browser/ui/panels/base_panel_browser_test.cc
+++ b/chrome/browser/ui/panels/base_panel_browser_test.cc
@@ -22,6 +22,7 @@
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/extensions/extension_manifest_constants.h"
+#include "chrome/test/base/interactive_test_utils.h"
#include "chrome/test/base/ui_test_utils.h"
#include "content/public/browser/notification_service.h"
#include "content/public/common/url_constants.h"
diff --git a/chrome/browser/ui/panels/panel_browsertest.cc b/chrome/browser/ui/panels/panel_browsertest.cc
index 71b6d10..ab388f0 100644
--- a/chrome/browser/ui/panels/panel_browsertest.cc
+++ b/chrome/browser/ui/panels/panel_browsertest.cc
@@ -6,6 +6,7 @@
#include "base/utf_string_conversions.h"
#include "chrome/app/chrome_command_ids.h"
#include "chrome/browser/debugger/devtools_window.h"
+#include "chrome/browser/extensions/extension_apitest.h"
#include "chrome/browser/net/url_request_mock_util.h"
#include "chrome/browser/prefs/browser_prefs.h"
#include "chrome/browser/prefs/pref_service.h"
@@ -25,9 +26,11 @@
#include "chrome/browser/ui/panels/test_panel_active_state_observer.h"
#include "chrome/browser/web_applications/web_app.h"
#include "chrome/common/chrome_notification_types.h"
+#include "chrome/common/chrome_switches.h"
#include "chrome/common/extensions/extension_manifest_constants.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/url_constants.h"
+#include "chrome/test/base/interactive_test_utils.h"
#include "chrome/test/base/ui_test_utils.h"
#include "content/public/browser/native_web_keyboard_event.h"
#include "content/public/browser/notification_service.h"
@@ -1747,3 +1750,26 @@ IN_PROC_BROWSER_TEST_F(PanelBrowserTest, MAYBE_Accelerator) {
signal.Wait();
EXPECT_EQ(0, panel_manager->num_panels());
}
+
+class PanelExtensionApiTest : public ExtensionApiTest {
+ protected:
+ virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
+ ExtensionApiTest::SetUpCommandLine(command_line);
+ command_line->AppendSwitch(switches::kEnablePanels);
+ }
+};
+
+#if defined(OS_LINUX) || defined(USE_AURA)
+// Focus test fails if there is no window manager on Linux.
+// Aura panels have different behavior that do not apply to this test.
+#define MAYBE_FocusChangeEventOnMinimize DISABLED_FocusChangeEventOnMinimize
+#else
+#define MAYBE_FocusChangeEventOnMinimize FocusChangeEventOnMinimize
+#endif
+IN_PROC_BROWSER_TEST_F(PanelExtensionApiTest,
+ MAYBE_FocusChangeEventOnMinimize) {
+ // This is needed so the subsequently created panels can be activated.
+ // On a Mac, it transforms background-only test process into foreground one.
+ ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser()));
+ ASSERT_TRUE(RunExtensionTest("panels/focus_change_on_minimize")) << message_;
+}
diff --git a/chrome/browser/ui/panels/panel_extension_browsertest.cc b/chrome/browser/ui/panels/panel_extension_browsertest.cc
index a642e06..ae2762d 100644
--- a/chrome/browser/ui/panels/panel_extension_browsertest.cc
+++ b/chrome/browser/ui/panels/panel_extension_browsertest.cc
@@ -6,7 +6,7 @@
#include "base/path_service.h"
#include "base/utf_string_conversions.h"
#include "chrome/app/chrome_command_ids.h"
-#include "chrome/browser/extensions/extension_apitest.h"
+#include "chrome/browser/extensions/extension_browsertest.h"
#include "chrome/browser/extensions/extension_test_message_listener.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/tab_contents/render_view_context_menu.h"
@@ -232,26 +232,3 @@ IN_PROC_BROWSER_TEST_F(PanelExtensionBrowserTest, CustomContextMenu) {
menu->ExecuteCommand(command_id);
EXPECT_TRUE(onclick_listener.WaitUntilSatisfied());
}
-
-class PanelExtensionApiTest : public ExtensionApiTest {
- protected:
- virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
- ExtensionApiTest::SetUpCommandLine(command_line);
- command_line->AppendSwitch(switches::kEnablePanels);
- }
-};
-
-#if defined(OS_LINUX) || defined(USE_AURA)
-// Focus test fails if there is no window manager on Linux.
-// Aura panels have different behavior that do not apply to this test.
-#define MAYBE_FocusChangeEventOnMinimize DISABLED_FocusChangeEventOnMinimize
-#else
-#define MAYBE_FocusChangeEventOnMinimize FocusChangeEventOnMinimize
-#endif
-IN_PROC_BROWSER_TEST_F(PanelExtensionApiTest,
- MAYBE_FocusChangeEventOnMinimize) {
- // This is needed so the subsequently created panels can be activated.
- // On a Mac, it transforms background-only test process into foreground one.
- ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser()));
- ASSERT_TRUE(RunExtensionTest("panels/focus_change_on_minimize")) << message_;
-}
diff --git a/chrome/browser/ui/views/bookmarks/bookmark_bar_view_test.cc b/chrome/browser/ui/views/bookmarks/bookmark_bar_view_test.cc
index a17d33f..6947e84 100644
--- a/chrome/browser/ui/views/bookmarks/bookmark_bar_view_test.cc
+++ b/chrome/browser/ui/views/bookmarks/bookmark_bar_view_test.cc
@@ -20,6 +20,7 @@
#include "chrome/browser/ui/views/bookmarks/bookmark_bar_view.h"
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/pref_names.h"
+#include "chrome/test/base/interactive_test_utils.h"
#include "chrome/test/base/test_browser_window.h"
#include "chrome/test/base/testing_browser_process.h"
#include "chrome/test/base/testing_profile.h"
diff --git a/chrome/browser/ui/views/button_dropdown_test.cc b/chrome/browser/ui/views/button_dropdown_test.cc
index 14a9f9b..6e89a4d 100644
--- a/chrome/browser/ui/views/button_dropdown_test.cc
+++ b/chrome/browser/ui/views/button_dropdown_test.cc
@@ -4,6 +4,7 @@
#include "base/message_loop.h"
#include "base/utf_string_conversions.h"
+#include "chrome/test/base/interactive_test_utils.h"
#include "chrome/test/base/ui_test_utils.h"
#include "chrome/test/base/view_event_test_base.h"
#include "ui/base/models/simple_menu_model.h"
diff --git a/chrome/browser/ui/views/find_bar_host_interactive_uitest.cc b/chrome/browser/ui/views/find_bar_host_interactive_uitest.cc
index 27f8e40..df5a8d2 100644
--- a/chrome/browser/ui/views/find_bar_host_interactive_uitest.cc
+++ b/chrome/browser/ui/views/find_bar_host_interactive_uitest.cc
@@ -15,6 +15,7 @@
#include "chrome/browser/ui/views/find_bar_host.h"
#include "chrome/browser/ui/views/frame/browser_view.h"
#include "chrome/common/chrome_notification_types.h"
+#include "chrome/test/base/interactive_test_utils.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/ui_test_utils.h"
#include "content/public/browser/notification_service.h"
diff --git a/chrome/browser/ui/views/keyboard_access_browsertest.cc b/chrome/browser/ui/views/keyboard_access_browsertest.cc
index ac8dbf7..66df9d7 100644
--- a/chrome/browser/ui/views/keyboard_access_browsertest.cc
+++ b/chrome/browser/ui/views/keyboard_access_browsertest.cc
@@ -13,6 +13,7 @@
#include "chrome/browser/ui/views/frame/browser_view.h"
#include "chrome/browser/ui/views/toolbar_view.h"
#include "chrome/common/chrome_notification_types.h"
+#include "chrome/test/base/interactive_test_utils.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/ui_test_utils.h"
#include "ui/base/events/event_constants.h"
diff --git a/chrome/browser/ui/views/menu_item_view_test.cc b/chrome/browser/ui/views/menu_item_view_test.cc
index 83476c9..acc67f44 100644
--- a/chrome/browser/ui/views/menu_item_view_test.cc
+++ b/chrome/browser/ui/views/menu_item_view_test.cc
@@ -4,6 +4,7 @@
#include "base/callback.h"
#include "base/utf_string_conversions.h"
+#include "chrome/test/base/interactive_test_utils.h"
#include "chrome/test/base/ui_test_utils.h"
#include "chrome/test/base/view_event_test_base.h"
#include "ui/ui_controls/ui_controls.h"
diff --git a/chrome/browser/ui/views/menu_model_adapter_test.cc b/chrome/browser/ui/views/menu_model_adapter_test.cc
index 24dedb9..74b44a5 100644
--- a/chrome/browser/ui/views/menu_model_adapter_test.cc
+++ b/chrome/browser/ui/views/menu_model_adapter_test.cc
@@ -4,6 +4,7 @@
#include "base/callback.h"
#include "base/utf_string_conversions.h"
+#include "chrome/test/base/interactive_test_utils.h"
#include "chrome/test/base/ui_test_utils.h"
#include "chrome/test/base/view_event_test_base.h"
#include "ui/base/models/menu_model.h"
diff --git a/chrome/browser/ui/views/ssl_client_certificate_selector_browsertest.cc b/chrome/browser/ui/views/ssl_client_certificate_selector_browsertest.cc
index 67556bc..4d1df63 100644
--- a/chrome/browser/ui/views/ssl_client_certificate_selector_browsertest.cc
+++ b/chrome/browser/ui/views/ssl_client_certificate_selector_browsertest.cc
@@ -10,6 +10,7 @@
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/browser/ui/views/ssl_client_certificate_selector.h"
+#include "chrome/test/base/interactive_test_utils.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/ui_test_utils.h"
#include "content/public/browser/web_contents.h"
diff --git a/chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc b/chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc
index 7bca443..ea80577 100644
--- a/chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc
+++ b/chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc
@@ -20,6 +20,7 @@
#include "chrome/browser/ui/views/tabs/tab_strip.h"
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/chrome_switches.h"
+#include "chrome/test/base/interactive_test_utils.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/ui_test_utils.h"
#include "content/public/browser/notification_details.h"
diff --git a/chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest_win.cc b/chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest_win.cc
index ce49624..30f3fb5 100644
--- a/chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest_win.cc
+++ b/chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest_win.cc
@@ -19,6 +19,7 @@
#include "chrome/browser/ui/views/tabs/tab_strip.h"
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/chrome_switches.h"
+#include "chrome/test/base/interactive_test_utils.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/ui_test_utils.h"
#include "content/public/browser/notification_details.h"
diff --git a/chrome/browser/ui/views/test/ui_test_utils_aura.cc b/chrome/browser/ui/views/test/ui_test_utils_aura.cc
deleted file mode 100644
index 2ee95b6..0000000
--- a/chrome/browser/ui/views/test/ui_test_utils_aura.cc
+++ /dev/null
@@ -1,31 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/ui/views/test/ui_test_utils_aura.h"
-
-#include "chrome/test/base/ui_test_utils.h"
-#include "ui/aura/window.h"
-
-namespace ui_test_utils {
-
-#if !defined(OS_WIN)
-void HideNativeWindow(gfx::NativeWindow window) {
- HideNativeWindowAura(window);
-}
-
-bool ShowAndFocusNativeWindow(gfx::NativeWindow window) {
- return ShowAndFocusNativeWindowAura(window);
-}
-#endif
-
-void HideNativeWindowAura(gfx::NativeWindow window) {
- window->Hide();
-}
-
-bool ShowAndFocusNativeWindowAura(gfx::NativeWindow window) {
- window->Show();
- return true;
-}
-
-} // namespace ui_test_utils
diff --git a/chrome/browser/ui/views/test/ui_test_utils_aura.h b/chrome/browser/ui/views/test/ui_test_utils_aura.h
deleted file mode 100644
index 6795434..0000000
--- a/chrome/browser/ui/views/test/ui_test_utils_aura.h
+++ /dev/null
@@ -1,21 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_BROWSER_UI_VIEWS_TEST_UI_TEST_UTILS_AURA_H_
-#define CHROME_BROWSER_UI_VIEWS_TEST_UI_TEST_UTILS_AURA_H_
-
-#include "chrome/test/base/ui_test_utils.h"
-
-#include "ui/aura/window.h"
-
-namespace ui_test_utils {
-
-// Aura variants of ui_test_utils method. Don't use these directly, they are
-// used to share code between win-aura and non-win-aura.
-void HideNativeWindowAura(gfx::NativeWindow window);
-bool ShowAndFocusNativeWindowAura(gfx::NativeWindow window);
-
-} // namespace ui_test_utils
-
-#endif // CHROME_BROWSER_UI_VIEWS_TEST_UI_TEST_UTILS_AURA_H_
diff --git a/chrome/browser/ui/views/test/ui_test_utils_views.cc b/chrome/browser/ui/views/test/ui_test_utils_views.cc
deleted file mode 100644
index c899594..0000000
--- a/chrome/browser/ui/views/test/ui_test_utils_views.cc
+++ /dev/null
@@ -1,54 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/test/base/ui_test_utils.h"
-
-#include "base/logging.h"
-#include "base/message_loop.h"
-#include "chrome/browser/ui/browser.h"
-#include "chrome/browser/ui/views/frame/browser_view.h"
-#include "ui/ui_controls/ui_controls.h"
-#include "ui/views/focus/focus_manager.h"
-
-namespace ui_test_utils {
-
-bool IsViewFocused(const Browser* browser, ViewID vid) {
- BrowserWindow* browser_window = browser->window();
- DCHECK(browser_window);
- gfx::NativeWindow window = browser_window->GetNativeWindow();
- DCHECK(window);
- const views::Widget* widget =
- views::Widget::GetTopLevelWidgetForNativeView(window);
- DCHECK(widget);
- const views::FocusManager* focus_manager = widget->GetFocusManager();
- DCHECK(focus_manager);
- DCHECK(focus_manager->GetFocusedView());
- return focus_manager->GetFocusedView()->id() == vid;
-}
-
-void ClickOnView(const Browser* browser, ViewID vid) {
- views::View* view =
- BrowserView::GetBrowserViewForBrowser(browser)->GetViewByID(vid);
- DCHECK(view);
- MoveMouseToCenterAndPress(
- view,
- ui_controls::LEFT,
- ui_controls::DOWN | ui_controls::UP,
- MessageLoop::QuitClosure());
- content::RunMessageLoop();
-}
-
-void MoveMouseToCenterAndPress(views::View* view,
- ui_controls::MouseButton button,
- int state,
- const base::Closure& closure) {
- DCHECK(view);
- DCHECK(view->GetWidget());
- gfx::Point view_center(view->width() / 2, view->height() / 2);
- views::View::ConvertPointToScreen(view, &view_center);
- ui_controls::SendMouseMove(view_center.x(), view_center.y());
- ui_controls::SendMouseEventsNotifyWhenDone(button, state, closure);
-}
-
-} // namespace ui_test_utils
diff --git a/chrome/browser/ui/views/test/ui_test_utils_win.cc b/chrome/browser/ui/views/test/ui_test_utils_win.cc
deleted file mode 100644
index dbf882e..0000000
--- a/chrome/browser/ui/views/test/ui_test_utils_win.cc
+++ /dev/null
@@ -1,129 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/test/base/ui_test_utils.h"
-
-#include "base/file_path.h"
-#include "base/file_util.h"
-#include "base/logging.h"
-#include "base/path_service.h"
-#include "base/stringprintf.h"
-#include "base/time.h"
-#include "chrome/browser/ui/window_snapshot/window_snapshot.h"
-#include "ui/base/win/foreground_helper.h"
-#include "ui/ui_controls/ui_controls.h"
-#include "ui/views/focus/focus_manager.h"
-
-#if defined(USE_AURA)
-#include "chrome/browser/ui/host_desktop.h"
-#include "chrome/browser/ui/views/test/ui_test_utils_aura.h"
-#include "ui/aura/root_window.h"
-#endif
-
-namespace ui_test_utils {
-
-namespace {
-
-const char kSnapshotBaseName[] = "ChromiumSnapshot";
-const char kSnapshotExtension[] = ".png";
-
-FilePath GetSnapshotFileName(const FilePath& snapshot_directory) {
- base::Time::Exploded the_time;
-
- base::Time::Now().LocalExplode(&the_time);
- std::string filename(StringPrintf("%s%04d%02d%02d%02d%02d%02d%s",
- kSnapshotBaseName, the_time.year, the_time.month, the_time.day_of_month,
- the_time.hour, the_time.minute, the_time.second, kSnapshotExtension));
-
- FilePath snapshot_file = snapshot_directory.AppendASCII(filename);
- if (file_util::PathExists(snapshot_file)) {
- int index = 0;
- std::string suffix;
- FilePath trial_file;
- do {
- suffix = StringPrintf(" (%d)", ++index);
- trial_file = snapshot_file.InsertBeforeExtensionASCII(suffix);
- } while (file_util::PathExists(trial_file));
- snapshot_file = trial_file;
- }
- return snapshot_file;
-}
-
-} // namespace
-
-void HideNativeWindow(gfx::NativeWindow window) {
-#if defined(USE_AURA)
- if (chrome::GetHostDesktopTypeForNativeWindow(window) ==
- chrome::HOST_DESKTOP_TYPE_ASH) {
- HideNativeWindowAura(window);
- return;
- }
- HWND hwnd = window->GetRootWindow()->GetAcceleratedWidget();
-#else
- HWND hwnd = window;
-#endif
- ::ShowWindow(hwnd, SW_HIDE);
-}
-
-bool ShowAndFocusNativeWindow(gfx::NativeWindow window) {
-#if defined(USE_AURA)
- if (chrome::GetHostDesktopTypeForNativeWindow(window) ==
- chrome::HOST_DESKTOP_TYPE_ASH)
- ShowAndFocusNativeWindowAura(window);
- // Always make sure the window hosting ash is visible and focused.
- HWND hwnd = window->GetRootWindow()->GetAcceleratedWidget();
-#else
- HWND hwnd = window;
-#endif
-
- ::ShowWindow(hwnd, SW_SHOW);
-
- if (GetForegroundWindow() != hwnd) {
- VLOG(1) << "Forcefully refocusing front window";
- ui::ForegroundHelper::SetForeground(hwnd);
- }
-
- // ShowWindow does not necessarily activate the window. In particular if a
- // window from another app is the foreground window then the request to
- // activate the window fails. See SetForegroundWindow for details.
- return GetForegroundWindow() == hwnd;
-}
-
-bool SaveScreenSnapshotToDirectory(const FilePath& directory,
- FilePath* screenshot_path) {
- bool succeeded = false;
- FilePath out_path(GetSnapshotFileName(directory));
-
- MONITORINFO monitor_info = {};
- monitor_info.cbSize = sizeof(monitor_info);
- HMONITOR main_monitor = MonitorFromWindow(NULL, MONITOR_DEFAULTTOPRIMARY);
- if (GetMonitorInfo(main_monitor, &monitor_info)) {
- RECT& rect = monitor_info.rcMonitor;
-
- std::vector<unsigned char> png_data;
- gfx::Rect bounds(
- gfx::Size(rect.right - rect.left, rect.bottom - rect.top));
- if (chrome::internal::GrabWindowSnapshot(NULL, &png_data, bounds) &&
- png_data.size() <= INT_MAX) {
- int bytes = static_cast<int>(png_data.size());
- int written = file_util::WriteFile(
- out_path, reinterpret_cast<char*>(&png_data[0]), bytes);
- succeeded = (written == bytes);
- }
- }
-
- if (succeeded && screenshot_path != NULL)
- *screenshot_path = out_path;
-
- return succeeded;
-}
-
-bool SaveScreenSnapshotToDesktop(FilePath* screenshot_path) {
- FilePath desktop;
-
- return PathService::Get(base::DIR_USER_DESKTOP, &desktop) &&
- SaveScreenSnapshotToDirectory(desktop, screenshot_path);
-}
-
-} // namespace ui_test_utils