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

Unified Diff: chrome/browser/component_updater/test/component_updater_service_unittest.h

Issue 18006003: Consistently use notifications from component updater w/ on-demand PNaCl. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cleanup test a bit Created 7 years, 6 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/browser/component_updater/test/component_updater_service_unittest.h
diff --git a/chrome/browser/component_updater/test/component_updater_service_unittest.h b/chrome/browser/component_updater/test/component_updater_service_unittest.h
index 4d7cd184d404146a5b9d4477ab3ef92adc0ff682..13ecc98fffacdd88fa9edae747af6986dd55fdce 100644
--- a/chrome/browser/component_updater/test/component_updater_service_unittest.h
+++ b/chrome/browser/component_updater/test/component_updater_service_unittest.h
@@ -93,6 +93,27 @@ class TestConfigurator : public ComponentUpdateService::Configurator {
ComponentUpdateService* cus_;
};
+// TestNotificationTracker does not keep a deep copy of the source,
+// so we will need to for testing. The test does not inspect the observations
+// as they occur -- only post mortem. Otherwise, the tester will end up
+// dereferencing an already-free'd pointer.
+class TestUpdateNotificationTracker : public TestNotificationTracker {
+public:
+ TestUpdateNotificationTracker();
+ virtual ~TestUpdateNotificationTracker();
+
+ ComponentUpdateService::UpdateSource SourceAt(size_t num);
+
+ virtual void Reset() OVERRIDE;
+
+private:
+ virtual void Observe(int type,
+ const content::NotificationSource& source,
+ const content::NotificationDetails& details) OVERRIDE;
+
+ std::vector<ComponentUpdateService::UpdateSource> sources_;
+};
+
class ComponentUpdaterTest : public testing::Test {
public:
enum TestComponents {
@@ -112,7 +133,7 @@ class ComponentUpdaterTest : public testing::Test {
// Makes the full path to a component updater test file.
const base::FilePath test_file(const char* file);
- TestNotificationTracker& notification_tracker();
+ TestUpdateNotificationTracker& notification_tracker();
TestConfigurator* test_configurator();
@@ -124,7 +145,7 @@ class ComponentUpdaterTest : public testing::Test {
private:
scoped_ptr<ComponentUpdateService> component_updater_;
base::FilePath test_data_dir_;
- TestNotificationTracker notification_tracker_;
+ TestUpdateNotificationTracker notification_tracker_;
TestConfigurator* test_config_;
};

Powered by Google App Engine
This is Rietveld 408576698