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

Unified Diff: chrome/browser/resources/settings/search_settings.js

Issue 2217493002: Revert of MD Settings: Adding some unit tests for <settings-main>. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@search_no_results
Patch Set: Created 4 years, 4 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/resources/settings/search_settings.js
diff --git a/chrome/browser/resources/settings/search_settings.js b/chrome/browser/resources/settings/search_settings.js
index 4d195ce1f176af70a5b34db813315124c54de234..f001427a140d760bf52ada4df340c8a092609fb8 100644
--- a/chrome/browser/resources/settings/search_settings.js
+++ b/chrome/browser/resources/settings/search_settings.js
@@ -100,7 +100,7 @@
* ensures that <settings-section> instances become visible if any matches
* occurred under their subtree.
*
- * @param {!settings.SearchRequest} request
+ * @param {!SearchRequest} request
* @param {!Node} root The root of the sub-tree to be searched
* @private
*/
@@ -167,11 +167,11 @@
/**
* @constructor
*
- * @param {!settings.SearchRequest} request
+ * @param {!SearchRequest} request
* @param {!Node} node
*/
function Task(request, node) {
- /** @protected {!settings.SearchRequest} */
+ /** @protected {!SearchRequest} */
this.request = request;
/** @protected {!Node} */
@@ -193,7 +193,7 @@
* @constructor
* @extends {Task}
*
- * @param {!settings.SearchRequest} request
+ * @param {!SearchRequest} request
* @param {!Node} node
*/
function RenderTask(request, node) {
@@ -227,7 +227,7 @@
* @constructor
* @extends {Task}
*
- * @param {!settings.SearchRequest} request
+ * @param {!SearchRequest} request
* @param {!Node} node
*/
function SearchAndHighlightTask(request, node) {
@@ -247,7 +247,7 @@
* @constructor
* @extends {Task}
*
- * @param {!settings.SearchRequest} request
+ * @param {!SearchRequest} request
* @param {!Node} page
*/
function TopLevelSearchTask(request, page) {
@@ -454,25 +454,11 @@
},
};
- /** @interface */
- var SearchManager = function() {};
-
- SearchManager.prototype = {
- /**
- * @param {string} text The text to search for.
- * @param {!Node} page
- * @return {!Promise<!settings.SearchRequest>} A signal indicating that
- * searching finished.
- */
- search: function(text, page) {}
- };
-
- /**
- * @constructor
- * @implements {SearchManager}
- */
- var SearchManagerImpl = function() {
- /** @private {?settings.SearchRequest} */
+ /**
+ * @constructor
+ */
+ var SearchManager = function() {
+ /** @private {?SearchRequest} */
this.activeRequest_ = null;
/** @private {!TaskQueue} */
@@ -483,15 +469,20 @@
this.activeRequest_ = null;
}.bind(this));
};
- cr.addSingletonGetter(SearchManagerImpl);
-
- SearchManagerImpl.prototype = {
- /** @override */
+ cr.addSingletonGetter(SearchManager);
+
+ SearchManager.prototype = {
+ /**
+ * @param {string} text The text to search for.
+ * @param {!Node} page
+ * @return {!Promise<!SearchRequest>} A signal indicating that searching
+ * finished.
+ */
search: function(text, page) {
// Creating a new request only if the |text| changed.
if (!this.activeRequest_ || !this.activeRequest_.isSame(text)) {
// Resolving previous search request without marking it as
- // 'finished', if any, and dropping all pending tasks.
+ // 'finisthed', if any, and droping all pending tasks.
this.queue_.reset();
if (this.activeRequest_)
this.activeRequest_.resolver.resolve(this.activeRequest_);
@@ -508,20 +499,10 @@
/** @return {!SearchManager} */
function getSearchManager() {
- return SearchManagerImpl.getInstance();
- }
-
- /**
- * Sets the SearchManager singleton instance, useful for testing.
- * @param {!SearchManager} searchManager
- */
- function setSearchManagerForTesting(searchManager) {
- SearchManagerImpl.instance_ = searchManager;
+ return SearchManager.getInstance();
}
return {
getSearchManager: getSearchManager,
- setSearchManagerForTesting: setSearchManagerForTesting,
- SearchRequest: SearchRequest,
};
});

Powered by Google App Engine
This is Rietveld 408576698