diff options
author | jcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-09-24 17:42:42 +0000 |
---|---|---|
committer | jcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-09-24 17:42:42 +0000 |
commit | 8a3422c9488ce79e305973d29a01811762e35465 (patch) | |
tree | 7fc94cb7aa013f7bb2afaf4100b1a8f45208cc00 /chrome/browser/automation/automation_tab_tracker.h | |
parent | 5eb64653873981c7dbf693a9aba7c7da011b14a3 (diff) | |
download | chromium_src-8a3422c9488ce79e305973d29a01811762e35465.zip chromium_src-8a3422c9488ce79e305973d29a01811762e35465.tar.gz chromium_src-8a3422c9488ce79e305973d29a01811762e35465.tar.bz2 |
This CL adds new UI tests for the SSL UI.
Some more info:
SSL UI Tests:
Added new tests for redirects and frames.
Also improved the mixed-content test to exercise the "block mixed-contents" preference and the show info-bar.
Automation:
For the new UI tests, added methods to tab_proxy and browser_proxy. The ones of most interest are GetLastNavigatinTime and WaitForNavigation that ensures we wait for a navigation to occur or have occured when taking actions that asynchronously trigger navigations.
Resource loading:
Added a flag to the response we get when loading a resource that indicates whether that resource was filtered (blocked or altered) by the security peer. We use this flag to notify back the browser when we report a load has been committed.
This is so the SSL manager knows a frame has been filtered (in which case we have no cert info but should not consider that as unsafe).
BUG=2004
Review URL: http://codereview.chromium.org/3165
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@2553 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/automation/automation_tab_tracker.h')
-rw-r--r-- | chrome/browser/automation/automation_tab_tracker.h | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/chrome/browser/automation/automation_tab_tracker.h b/chrome/browser/automation/automation_tab_tracker.h index 5cda520..bb9ac24 100644 --- a/chrome/browser/automation/automation_tab_tracker.h +++ b/chrome/browser/automation/automation_tab_tracker.h @@ -28,6 +28,11 @@ public: NotificationService::current()->AddObserver( this, NOTIFY_EXTERNAL_TAB_CLOSED, Source<NavigationController>(resource)); + // We also want to know about navigations so we can keep track of the last + // navigation time. + NotificationService::current()->AddObserver( + this, NOTIFY_NAV_ENTRY_COMMITTED, + Source<NavigationController>(resource)); } virtual void RemoveObserver(NavigationController* resource) { @@ -36,7 +41,49 @@ public: NotificationService::current()->RemoveObserver( this, NOTIFY_EXTERNAL_TAB_CLOSED, Source<NavigationController>(resource)); + NotificationService::current()->RemoveObserver( + this, NOTIFY_NAV_ENTRY_COMMITTED, + Source<NavigationController>(resource)); + } + + virtual void Observe(NotificationType type, + const NotificationSource& source, + const NotificationDetails& details) { + switch (type) { + case NOTIFY_NAV_ENTRY_COMMITTED: + last_navigation_times_[Source<NavigationController>(source).ptr()] = + Time::Now(); + return; + case NOTIFY_EXTERNAL_TAB_CLOSED: + case NOTIFY_TAB_CLOSING: + std::map<NavigationController*, Time>::iterator iter = + last_navigation_times_.find( + Source<NavigationController>(source).ptr()); + if (iter != last_navigation_times_.end()) + last_navigation_times_.erase(iter); + break; + } + AutomationResourceTracker::Observe(type, source, details); + } + + Time GetLastNavigationTime(int handle) { + if (ContainsHandle(handle)) { + NavigationController* controller = GetResource(handle); + if (controller) { + std::map<NavigationController*, Time>::const_iterator iter = + last_navigation_times_.find(controller); + if (iter != last_navigation_times_.end()) + return iter->second; + } + } + return Time(); } + + private: + // Last time a navigation occurred. + std::map<NavigationController*, Time> last_navigation_times_; + + DISALLOW_COPY_AND_ASSIGN(AutomationTabTracker); }; #endif // CHROME_BROWSER_AUTOMATION_AUTOMATION_TAB_TRACKER_H__ |