blob: ef4cb1689cabdb531070162f480fccbc7073423d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
// Copyright (c) 2009 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_api.h"
#include "chrome/common/notification_service.h"
namespace extension_test_api_functions {
const char kPassFunction[] = "test.notifyPass";
const char kFailFunction[] = "test.notifyFail";
const char kLogFunction[] = "test.log";
}; // namespace extension_test_api_functions
bool ExtensionTestPassFunction::RunImpl() {
NotificationService::current()->Notify(
NotificationType::EXTENSION_TEST_PASSED,
Source<Profile>(dispatcher()->profile()),
NotificationService::NoDetails());
return true;
}
bool ExtensionTestFailFunction::RunImpl() {
std::string message;
EXTENSION_FUNCTION_VALIDATE(args_->GetAsString(&message));
NotificationService::current()->Notify(
NotificationType::EXTENSION_TEST_FAILED,
Source<Profile>(dispatcher()->profile()),
Details<std::string>(&message));
return true;
}
bool ExtensionTestLogFunction::RunImpl() {
std::string message;
EXTENSION_FUNCTION_VALIDATE(args_->GetAsString(&message));
printf("%s\n", message.c_str());
LOG(INFO) << message;
return true;
}
|