summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-05 00:40:06 +0000
committerestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-05 00:40:06 +0000
commit13869ddf1b7851b4e3a92b7f8f25c606ca5a3536 (patch)
tree0803bddb2367698c9595c480c287c0f2db833f9f /chrome
parent140aea057fa118579380f685f362f2533862b03f (diff)
downloadchromium_src-13869ddf1b7851b4e3a92b7f8f25c606ca5a3536.zip
chromium_src-13869ddf1b7851b4e3a92b7f8f25c606ca5a3536.tar.gz
chromium_src-13869ddf1b7851b4e3a92b7f8f25c606ca5a3536.tar.bz2
Linux: enable omni box ui test and automation proxy ui test.
Enable a lot of (already essentially working) automation code along the way. Review URL: http://codereview.chromium.org/100278 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@15258 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/automation/automation_autocomplete_edit_tracker.h10
-rw-r--r--chrome/browser/automation/automation_provider.cc28
-rw-r--r--chrome/browser/automation/automation_provider.h4
-rw-r--r--chrome/browser/cocoa/location_bar_view_mac.h5
-rw-r--r--chrome/browser/gtk/location_bar_view_gtk.h7
-rw-r--r--chrome/browser/location_bar.h4
-rw-r--r--chrome/browser/views/location_bar_view.h7
-rw-r--r--chrome/chrome.gyp3
-rw-r--r--chrome/common/temp_scaffolding_stubs.cc4
-rw-r--r--chrome/test/automation/automation_proxy_uitest.cc4
-rw-r--r--chrome/test/test_location_bar.h3
-rw-r--r--chrome/test/ui/omnibox_uitest.cc6
12 files changed, 49 insertions, 36 deletions
diff --git a/chrome/browser/automation/automation_autocomplete_edit_tracker.h b/chrome/browser/automation/automation_autocomplete_edit_tracker.h
index 46b8eae..5a7c8e4 100644
--- a/chrome/browser/automation/automation_autocomplete_edit_tracker.h
+++ b/chrome/browser/automation/automation_autocomplete_edit_tracker.h
@@ -2,18 +2,18 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_AUTOMATION_AUTOMATION_AUTOCOMPLETE_EDIT_TRACKER_H__
-#define CHROME_BROWSER_AUTOMATION_AUTOMATION_AUTOCOMPLETE_EDIT_TRACKER_H__
+#ifndef CHROME_BROWSER_AUTOMATION_AUTOMATION_AUTOCOMPLETE_EDIT_TRACKER_H_
+#define CHROME_BROWSER_AUTOMATION_AUTOMATION_AUTOCOMPLETE_EDIT_TRACKER_H_
#include "chrome/browser/autocomplete/autocomplete_edit.h"
#include "chrome/browser/autocomplete/autocomplete_edit_view.h"
#include "chrome/browser/automation/automation_resource_tracker.h"
-class AutomationAutocompleteEditTracker:
+class AutomationAutocompleteEditTracker :
public AutomationResourceTracker<AutocompleteEditView*> {
public:
explicit AutomationAutocompleteEditTracker(IPC::Message::Sender* automation)
- : AutomationResourceTracker(automation) { }
+ : AutomationResourceTracker<AutocompleteEditView*>(automation) { }
virtual ~AutomationAutocompleteEditTracker() {
ClearAllMappings();
@@ -32,4 +32,4 @@ class AutomationAutocompleteEditTracker:
}
};
-#endif // CHROME_BROWSER_AUTOMATION_AUTOMATION_AUTOCOMPLETE_EDIT_TRACKER_H__
+#endif // CHROME_BROWSER_AUTOMATION_AUTOMATION_AUTOCOMPLETE_EDIT_TRACKER_H_
diff --git a/chrome/browser/automation/automation_provider.cc b/chrome/browser/automation/automation_provider.cc
index 67dc491..ec2284f 100644
--- a/chrome/browser/automation/automation_provider.cc
+++ b/chrome/browser/automation/automation_provider.cc
@@ -22,6 +22,7 @@
#include "chrome/browser/find_bar.h"
#include "chrome/browser/find_bar_controller.h"
#include "chrome/browser/find_notification_details.h"
+#include "chrome/browser/location_bar.h"
#include "chrome/browser/renderer_host/render_view_host.h"
#include "chrome/browser/ssl/ssl_manager.h"
#include "chrome/browser/ssl/ssl_blocking_page.h"
@@ -45,10 +46,13 @@
#include "chrome/browser/external_tab_container.h"
#include "chrome/browser/login_prompt.h"
#include "chrome/browser/printing/print_job.h"
+#endif // defined(OS_WIN)
+
+#if defined(OS_WIN)
#include "chrome/browser/views/bookmark_bar_view.h"
-#include "chrome/browser/views/location_bar_view.h"
+#include "chrome/views/widget/widget_win.h"
#include "chrome/views/window/window.h"
-#endif // defined(OS_WIN)
+#endif
using base::Time;
@@ -783,10 +787,10 @@ AutomationProvider::AutomationProvider(Profile* profile)
browser_tracker_.reset(new AutomationBrowserTracker(this));
tab_tracker_.reset(new AutomationTabTracker(this));
window_tracker_.reset(new AutomationWindowTracker(this));
-#if defined(OS_WIN)
- // TODO(port): Enable as the trackers get ported.
autocomplete_edit_tracker_.reset(
new AutomationAutocompleteEditTracker(this));
+#if defined(OS_WIN)
+ // TODO(port): Enable as the trackers get ported.
cwindow_tracker_.reset(new AutomationConstrainedWindowTracker(this));
new_tab_ui_load_observer_.reset(new NewTabUILoadObserver(this));
#endif // defined(OS_WIN)
@@ -2192,8 +2196,7 @@ void AutomationProvider::GetWindowForBrowser(int browser_handle,
}
}
-#if defined(OS_WIN)
-// TODO(port): Remove windowsisms.
+#if defined(OS_WIN) || defined(OS_LINUX)
void AutomationProvider::GetAutocompleteEditForBrowser(
int browser_handle,
bool* success,
@@ -2203,16 +2206,17 @@ void AutomationProvider::GetAutocompleteEditForBrowser(
if (browser_tracker_->ContainsHandle(browser_handle)) {
Browser* browser = browser_tracker_->GetResource(browser_handle);
- BrowserWindowTesting* testing_interface =
- browser->window()->GetBrowserWindowTesting();
- LocationBarView* loc_bar_view = testing_interface->GetLocationBarView();
- AutocompleteEditView* edit_view = loc_bar_view->location_entry();
+ LocationBar* loc_bar = browser->window()->GetLocationBar();
+ AutocompleteEditView* edit_view = loc_bar->location_entry();
// Add() returns the existing handle for the resource if any.
*autocomplete_edit_handle = autocomplete_edit_tracker_->Add(edit_view);
*success = true;
}
}
+#endif // defined(OS_WIN) || defined(OS_LINUX)
+#if defined(OS_WIN)
+// TODO(port): Remove windowsisms.
void AutomationProvider::GetBrowserForWindow(int window_handle,
bool* success,
int* browser_handle) {
@@ -2536,7 +2540,7 @@ void AutomationProvider::SavePage(int tab_handle,
*success = true;
}
-#if defined(OS_WIN)
+#if defined(OS_WIN) || defined(OS_LINUX)
// TODO(port): Enable these.
void AutomationProvider::GetAutocompleteEditText(int autocomplete_edit_handle,
bool* success,
@@ -2612,7 +2616,7 @@ void AutomationProvider::OnMessageFromExternalHost(int handle,
view_host->ForwardMessageFromExternalHost(message, origin, target);
}
}
-#endif // defined(OS_WIN)
+#endif // defined(OS_WIN) || defined(OS_LINUX)
TabContents* AutomationProvider::GetTabContentsForHandle(
int handle, NavigationController** tab) {
diff --git a/chrome/browser/automation/automation_provider.h b/chrome/browser/automation/automation_provider.h
index 2849cd1..6a64b0c 100644
--- a/chrome/browser/automation/automation_provider.h
+++ b/chrome/browser/automation/automation_provider.h
@@ -16,6 +16,7 @@
#include <vector>
#include "base/basictypes.h"
+#include "chrome/browser/automation/automation_autocomplete_edit_tracker.h"
#include "chrome/browser/automation/automation_browser_tracker.h"
#include "chrome/browser/automation/automation_tab_tracker.h"
#include "chrome/browser/automation/automation_window_tracker.h"
@@ -30,7 +31,6 @@
#if defined(OS_WIN)
// TODO(port): enable these.
-#include "chrome/browser/automation/automation_autocomplete_edit_tracker.h"
#include "chrome/browser/automation/automation_constrained_window_tracker.h"
enum AutomationMsg_NavigationResponseValues;
#endif
@@ -459,8 +459,8 @@ class AutomationProvider : public base::RefCounted<AutomationProvider>,
#if defined(OS_WIN)
// TODO(port): Enable as trackers get ported.
scoped_ptr<AutomationConstrainedWindowTracker> cwindow_tracker_;
- scoped_ptr<AutomationAutocompleteEditTracker> autocomplete_edit_tracker_;
#endif
+ scoped_ptr<AutomationAutocompleteEditTracker> autocomplete_edit_tracker_;
scoped_ptr<NavigationControllerRestoredObserver> restore_tracker_;
LoginHandlerMap login_handler_map_;
NotificationObserverList notification_observer_list_;
diff --git a/chrome/browser/cocoa/location_bar_view_mac.h b/chrome/browser/cocoa/location_bar_view_mac.h
index 5897a8f..ee9cf26 100644
--- a/chrome/browser/cocoa/location_bar_view_mac.h
+++ b/chrome/browser/cocoa/location_bar_view_mac.h
@@ -9,9 +9,9 @@
#include "base/scoped_ptr.h"
#include "chrome/browser/autocomplete/autocomplete_edit.h"
+#include "chrome/browser/autocomplete/autocomplete_edit_view_mac.h"
#include "chrome/browser/location_bar.h"
-class AutocompleteEditViewMac;
class CommandUpdater;
class ToolbarModel;
@@ -42,6 +42,9 @@ class LocationBarViewMac : public AutocompleteEditController,
virtual void UpdatePageActions() { NOTIMPLEMENTED(); }
virtual void SaveStateToContents(TabContents* contents);
virtual void Revert();
+ virtual AutocompleteEditView* location_entry() {
+ return edit_view_.get();
+ }
virtual void OnAutocompleteAccept(const GURL& url,
WindowOpenDisposition disposition,
diff --git a/chrome/browser/gtk/location_bar_view_gtk.h b/chrome/browser/gtk/location_bar_view_gtk.h
index aa4866e..c60d463 100644
--- a/chrome/browser/gtk/location_bar_view_gtk.h
+++ b/chrome/browser/gtk/location_bar_view_gtk.h
@@ -46,10 +46,6 @@ class LocationBarViewGtk : public AutocompleteEditController,
// restore saved state that the tab holds.
void Update(const TabContents* tab_for_state_restoring);
- AutocompleteEditView* location_entry() {
- return location_entry_.get();
- }
-
// Implement the AutocompleteEditController interface.
virtual void OnAutocompleteAccept(const GURL& url,
WindowOpenDisposition disposition,
@@ -72,6 +68,9 @@ class LocationBarViewGtk : public AutocompleteEditController,
virtual void UpdatePageActions();
virtual void SaveStateToContents(TabContents* contents);
virtual void Revert();
+ virtual AutocompleteEditView* location_entry() {
+ return location_entry_.get();
+ }
// Translation between a security level and the background color. Both the
// location bar and edit have to manage and match the background color.
diff --git a/chrome/browser/location_bar.h b/chrome/browser/location_bar.h
index d885709..70a06d5 100644
--- a/chrome/browser/location_bar.h
+++ b/chrome/browser/location_bar.h
@@ -16,6 +16,7 @@
#include "chrome/common/page_transition_types.h"
#include "webkit/glue/window_open_disposition.h"
+class AutocompleteEditView;
class TabContents;
class LocationBar {
@@ -56,6 +57,9 @@ class LocationBar {
// Reverts the location bar. The bar's permanent text will be shown.
virtual void Revert() = 0;
+
+ // Returns a pointer to the text entry view.
+ virtual AutocompleteEditView* location_entry() = 0;
};
#endif // CHROME_BROWSER_LOCATION_BAR_H_
diff --git a/chrome/browser/views/location_bar_view.h b/chrome/browser/views/location_bar_view.h
index 456204d..883d3c3 100644
--- a/chrome/browser/views/location_bar_view.h
+++ b/chrome/browser/views/location_bar_view.h
@@ -110,10 +110,6 @@ class LocationBarView : public LocationBar,
// Returns the accessibility role.
bool GetAccessibleRole(AccessibilityTypes::Role* role);
- AutocompleteEditView* location_entry() {
- return location_entry_.get();
- }
-
// Overridden from views::View:
virtual bool OverrideAccelerator(const views::Accelerator& accelerator);
@@ -129,6 +125,9 @@ class LocationBarView : public LocationBar,
virtual void UpdatePageActions();
virtual void SaveStateToContents(TabContents* contents);
virtual void Revert();
+ virtual AutocompleteEditView* location_entry() {
+ return location_entry_.get();
+ }
static const int kVertMargin;
static const COLORREF kBackgroundColorByLevel[];
diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp
index 649cb03..e52bbce 100644
--- a/chrome/chrome.gyp
+++ b/chrome/chrome.gyp
@@ -2053,8 +2053,6 @@
],
}, { # OS != "win"
'sources!': [
- 'test/automation/autocomplete_edit_proxy.cc',
- 'test/automation/autocomplete_edit_proxy.h',
'test/in_process_browser_test.cc',
'test/in_process_browser_test.h',
'test/ui_test_utils.cc',
@@ -2241,7 +2239,6 @@
'browser/metrics/metrics_service_uitest.cc',
'test/reliability/page_load_test.cc',
'test/ui/layout_plugin_uitest.cc',
- 'test/ui/omnibox_uitest.cc',
],
}],
['OS=="mac"', {
diff --git a/chrome/common/temp_scaffolding_stubs.cc b/chrome/common/temp_scaffolding_stubs.cc
index ce88a70..8cfcccd 100644
--- a/chrome/common/temp_scaffolding_stubs.cc
+++ b/chrome/common/temp_scaffolding_stubs.cc
@@ -39,6 +39,7 @@ void AutomationProvider::GetFocusedViewID(int handle, int* view_id) {
NOTIMPLEMENTED();
}
+#if defined(OS_MACOSX)
void AutomationProvider::GetAutocompleteEditForBrowser(
int browser_handle,
bool* success,
@@ -46,6 +47,7 @@ void AutomationProvider::GetAutocompleteEditForBrowser(
*success = false;
NOTIMPLEMENTED();
}
+#endif
void AutomationProvider::GetBrowserForWindow(int window_handle,
bool* success,
@@ -78,6 +80,7 @@ void AutomationProvider::PrintNow(int tab_handle,
NOTIMPLEMENTED();
}
+#if defined(OS_MACOSX)
void AutomationProvider::GetAutocompleteEditText(int autocomplete_edit_handle,
bool* success,
std::wstring* text) {
@@ -113,6 +116,7 @@ void AutomationProvider::OnMessageFromExternalHost(
const std::string& target) {
NOTIMPLEMENTED();
}
+#endif // defined(OS_MACOSX)
//--------------------------------------------------------------------------
diff --git a/chrome/test/automation/automation_proxy_uitest.cc b/chrome/test/automation/automation_proxy_uitest.cc
index e650c35..e3bca00 100644
--- a/chrome/test/automation/automation_proxy_uitest.cc
+++ b/chrome/test/automation/automation_proxy_uitest.cc
@@ -974,7 +974,7 @@ TEST_F(ExternalTabTestType, ExternalTabPostMessage) {
#endif // defined(OS_WIN)
// TODO(port): Need to port autocomplete_edit_proxy.* first.
-#if defined(OS_WIN)
+#if defined(OS_WIN) || defined(OS_LINUX)
TEST_F(AutomationProxyTest, AutocompleteGetSetText) {
scoped_ptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
ASSERT_TRUE(browser.get());
@@ -1035,7 +1035,7 @@ TEST_F(AutomationProxyVisibleTest, AutocompleteMatchesTest) {
EXPECT_TRUE(edit->GetAutocompleteMatches(&matches));
EXPECT_FALSE(matches.empty());
}
-#endif // defined(OS_WIN)
+#endif // defined(OS_WIN) || defined(OS_LINUX)
// Disabled because flaky see bug #5314.
TEST_F(AutomationProxyTest, DISABLED_AppModalDialogTest) {
diff --git a/chrome/test/test_location_bar.h b/chrome/test/test_location_bar.h
index 948f20a..d347837 100644
--- a/chrome/test/test_location_bar.h
+++ b/chrome/test/test_location_bar.h
@@ -40,6 +40,9 @@ class TestLocationBar : public LocationBar {
virtual void UpdatePageActions() {}
virtual void SaveStateToContents(TabContents* contents) {}
virtual void Revert() {}
+ virtual AutocompleteEditView* location_entry() {
+ return NULL;
+ }
private:
diff --git a/chrome/test/ui/omnibox_uitest.cc b/chrome/test/ui/omnibox_uitest.cc
index d8c5c5a..4620418 100644
--- a/chrome/test/ui/omnibox_uitest.cc
+++ b/chrome/test/ui/omnibox_uitest.cc
@@ -58,13 +58,13 @@ class OmniboxTest : public UITest {
bool OmniboxTest::IsMatch(const std::wstring& input_text,
const std::wstring& suggestion) {
// This prefix list comes from the list used in history_url_provider.cc
- // withiff the exception of "ftp." and "www.".
+ // with the exception of "ftp." and "www.".
std::wstring prefixes[] = {L"", L"ftp://", L"http://", L"https://",
L"ftp.", L"www.", L"ftp://www.", L"ftp://ftp.",
L"http://www.", L"https://www."};
std::wstring postfixes[] = {L"", L"/"};
- for (int i = 0; i < sizeof(prefixes) / sizeof(std::wstring); ++i) {
- for (int j = 0; j < sizeof(postfixes) / sizeof(std::wstring); ++j) {
+ for (size_t i = 0; i < arraysize(prefixes); ++i) {
+ for (size_t j = 0; j < arraysize(postfixes); ++j) {
if (prefixes[i] + input_text + postfixes[j] == suggestion)
return true;
}