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

Unified Diff: chrome/browser/extensions/extension_test_message_listener.cc

Issue 3017047: Set a max limit on extension items' labels in context menus.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 5 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/extensions/extension_test_message_listener.cc
===================================================================
--- chrome/browser/extensions/extension_test_message_listener.cc (revision 0)
+++ chrome/browser/extensions/extension_test_message_listener.cc (revision 0)
@@ -0,0 +1,43 @@
+// Copyright (c) 2010 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.
+
+#include "chrome/browser/extensions/extension_test_message_listener.h"
+
+#include "base/logging.h"
+#include "chrome/common/notification_service.h"
+#include "chrome/common/notification_type.h"
+#include "chrome/test/ui_test_utils.h"
+
+ExtensionTestMessageListener::ExtensionTestMessageListener(
+ const std::string& expected_message)
+ : expected_message_(expected_message), satisfied_(false),
+ waiting_(false) {
+ registrar_.Add(this, NotificationType::EXTENSION_TEST_MESSAGE,
+ NotificationService::AllSources());
+}
+
+ExtensionTestMessageListener::~ExtensionTestMessageListener() {}
+
+bool ExtensionTestMessageListener::WaitUntilSatisfied() {
+ if (satisfied_)
+ return true;
+ waiting_ = true;
+ ui_test_utils::RunMessageLoop();
+ return satisfied_;
+}
+
+void ExtensionTestMessageListener::Observe(
+ NotificationType type,
+ const NotificationSource& source,
+ const NotificationDetails& details) {
+ const std::string& content = *Details<std::string>(details).ptr();
+ if (!satisfied_ && content == expected_message_) {
+ satisfied_ = true;
+ registrar_.RemoveAll(); // Stop listening for more messages.
+ if (waiting_) {
+ waiting_ = false;
+ MessageLoopForUI::current()->Quit();
+ }
+ }
+}
Property changes on: chrome/browser/extensions/extension_test_message_listener.cc
___________________________________________________________________
Name: svn:eol-style
+ LF
« no previous file with comments | « chrome/browser/extensions/extension_test_message_listener.h ('k') | chrome/browser/tab_contents/render_view_context_menu.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698