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

Unified Diff: base/path_service_unittest.cc

Issue 7087014: Support automatic javascript test registry in gtest when creating WebUI tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 7 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: base/path_service_unittest.cc
diff --git a/base/path_service_unittest.cc b/base/path_service_unittest.cc
index 26998de5c097ceaccf95e83f0cac54056c0a0255..5d70fdf9659041b5107a7cb6c2dffb23d34b8820 100644
--- a/base/path_service_unittest.cc
+++ b/base/path_service_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -39,6 +39,17 @@ bool ReturnsInvalidPath(int dir_type) {
}
#endif
+const int kSimpleProviderKey = 9999;
+const FilePath::CharType kSimpleProviderPath[] = ".";
+
+bool SimpleProvider(int key, FilePath* result) {
+ if (key == kSimpleProviderKey) {
+ *result = FilePath(kSimpleProviderPath);
+ return true;
+ }
+ return false;
+}
+
} // namespace
// On the Mac this winds up using some autoreleased objects, so we need to
@@ -70,3 +81,12 @@ TEST_F(PathServiceTest, Get) {
}
#endif
}
+
+TEST_F(PathServiceTest, RegisterUnregister) {
+ EXPECT_FALSE(ReturnsValidPath(kSimpleProviderKey)) << kSimpleProviderKey;
+ PathService::RegisterProvider(&SimpleProvider,
+ kSimpleProviderKey, kSimpleProviderKey+1);
+ EXPECT_TRUE(ReturnsValidPath(kSimpleProviderKey)) << kSimpleProviderKey;
+ PathService::UnregisterProvider(&SimpleProvider);
+ EXPECT_FALSE(ReturnsValidPath(kSimpleProviderKey)) << kSimpleProviderKey;
+}

Powered by Google App Engine
This is Rietveld 408576698