Index: chrome/test/test_navigation_observer.h |
diff --git a/chrome/test/test_tab_strip_model_observer.h b/chrome/test/test_navigation_observer.h |
similarity index 62% |
copy from chrome/test/test_tab_strip_model_observer.h |
copy to chrome/test/test_navigation_observer.h |
index a41e5dfed2aec4a56ef72a668569c343df80ce7f..1b29925996f38eabfeb939ee3df52ebd3acfe768 100644 |
--- a/chrome/test/test_tab_strip_model_observer.h |
+++ b/chrome/test/test_navigation_observer.h |
@@ -2,16 +2,15 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-#ifndef CHROME_TEST_TEST_TAB_STRIP_MODEL_OBSERVER_H_ |
-#define CHROME_TEST_TEST_TAB_STRIP_MODEL_OBSERVER_H_ |
+#ifndef CHROME_TEST_TEST_NAVIGATION_OBSERVER_H_ |
+#define CHROME_TEST_TEST_NAVIGATION_OBSERVER_H_ |
#pragma once |
#include "base/compiler_specific.h" |
-#include "chrome/browser/tabs/tab_strip_model_observer.h" |
#include "content/common/notification_observer.h" |
#include "content/common/notification_registrar.h" |
-class TabStripModel; |
+class TabContentsWrapper; |
// In order to support testing of print preview, we need to wait for the tab to |
// be inserted, and then observe notifications on the newly added tab's |
@@ -20,8 +19,7 @@ class TabStripModel; |
// javascript before the webui page loads by calling back through the |
// TestTabStripModelObserver::LoadStartObserver when the new page starts |
// loading. |
-class TestTabStripModelObserver : public TabStripModelObserver, |
- public NotificationObserver { |
+class TestNavigationObserver : public NotificationObserver { |
public: |
class LoadStartObserver { |
public: |
@@ -32,20 +30,20 @@ class TestTabStripModelObserver : public TabStripModelObserver, |
virtual void OnLoadStart() = 0; |
}; |
- // Observe the |tab_strip_model|, which may not be NULL. If |
- // |load_start_observer| is non-NULL, notify when the page load starts. |
- TestTabStripModelObserver(TabStripModel* tab_strip_model, |
- LoadStartObserver* load_start_observer); |
- virtual ~TestTabStripModelObserver(); |
+ TestNavigationObserver(TabContentsWrapper* contents, |
+ LoadStartObserver* load_start_observer); |
+ |
+ virtual ~TestNavigationObserver(); |
// Run the UI message loop until |done_| becomes true. |
void WaitForObservation(); |
- private: |
- // TabStripModelObserver: |
- virtual void TabInsertedAt(TabContentsWrapper* contents, int index, |
- bool foreground) OVERRIDE; |
+ protected: |
+ explicit TestNavigationObserver(LoadStartObserver* load_start_observer); |
+ |
+ void RegisterAsObserver(TabContentsWrapper* contents); |
+ private: |
// NotificationObserver: |
David Tseng
2011/07/07 19:26:28
Overrides?
|
virtual void Observe(NotificationType type, const NotificationSource& source, |
const NotificationDetails& details) OVERRIDE; |
@@ -55,16 +53,15 @@ class TestTabStripModelObserver : public TabStripModelObserver, |
// If true the navigation has started. |
bool navigation_started_; |
+ // If true the navigation has been committed. |
+ bool navigation_entry_committed_; |
+ |
// The number of navigations that have been completed. |
int navigations_completed_; |
// The number of navigations to wait for. |
int number_of_navigations_; |
- // |tab_strip_model_| is the object this observes. The constructor will |
- // register this as an observer, and the destructor will remove the observer. |
- TabStripModel* tab_strip_model_; |
- |
// Observer to take some action when the page load starts. |
LoadStartObserver* load_start_observer_; |
@@ -74,7 +71,7 @@ class TestTabStripModelObserver : public TabStripModelObserver, |
// |running_| will be true during WaitForObservation until |done_| is true. |
bool running_; |
- DISALLOW_COPY_AND_ASSIGN(TestTabStripModelObserver); |
+ DISALLOW_COPY_AND_ASSIGN(TestNavigationObserver); |
}; |
-#endif // CHROME_TEST_TEST_TAB_STRIP_MODEL_OBSERVER_H_ |
+#endif // CHROME_TEST_TEST_NAVIGATION_OBSERVER_H_ |