#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
-#include "chrome/browser/chrome_notification_types.h"
-#include "chrome/browser/chrome_notification_types.h"
-#include "chrome/browser/extensions/api/test/test_api.h"
-#include "chrome/test/base/ui_test_utils.h"
#include "content/public/browser/notification_service.h"
#include "content/public/browser/notification_source.h"
+#include "content/public/test/test_utils.h"
+#include "extensions/browser/api/test/test_api.h"
+#include "extensions/browser/notification_types.h"
ExtensionTestMessageListener::ExtensionTestMessageListener(
const std::string& expected_message,
will_reply_(will_reply),
replied_(false),
failed_(false) {
- registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_TEST_MESSAGE,
+ registrar_.Add(this,
+ extensions::NOTIFICATION_EXTENSION_TEST_MESSAGE,
content::NotificationService::AllSources());
}
replied_(false),
failed_(false) {
registrar_.Add(this,
- chrome::NOTIFICATION_EXTENSION_TEST_MESSAGE,
+ extensions::NOTIFICATION_EXTENSION_TEST_MESSAGE,
content::NotificationService::AllSources());
}
Reply(base::IntToString(message));
}
+void ExtensionTestMessageListener::ReplyWithError(const std::string& error) {
+ CHECK(satisfied_);
+ CHECK(!replied_);
+
+ replied_ = true;
+ function_->ReplyWithError(error);
+ function_ = NULL;
+}
+
void ExtensionTestMessageListener::Reset() {
satisfied_ = false;
failed_ = false;
int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) {
+ DCHECK_EQ(extensions::NOTIFICATION_EXTENSION_TEST_MESSAGE, type);
+
// Return immediately if we're already satisfied or it's not the right
// extension.
extensions::TestSendMessageFunction* function =
// Reply immediately, or save the function for future use.
function_ = function;
if (!will_reply_)
- Reply(base::EmptyString());
+ Reply(std::string());
if (waiting_) {
waiting_ = false;