1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "ppapi/tests/test_console.h"
7 #include "ppapi/cpp/module.h"
8 #include "ppapi/tests/testing_instance.h"
10 REGISTER_TEST_CASE(Console
);
12 TestConsole::TestConsole(TestingInstance
* instance
)
14 console_interface_(NULL
) {
17 bool TestConsole::Init() {
18 console_interface_
= static_cast<const PPB_Console
*>(
19 pp::Module::Get()->GetBrowserInterface(PPB_CONSOLE_INTERFACE
));
20 return !!console_interface_
;
23 void TestConsole::RunTests(const std::string
& filter
) {
24 RUN_TEST(Smoke
, filter
);
27 std::string
TestConsole::TestSmoke() {
28 // This test does not verify the log message actually reaches the console, but
29 // it does test that the interface exists and that it can be called without
31 pp::Var
source(std::string("somewhere"));
32 pp::Var
message(std::string("hello, world."));
33 console_interface_
->Log(instance()->pp_instance(), PP_LOGLEVEL_ERROR
,
35 console_interface_
->LogWithSource(instance()->pp_instance(), PP_LOGLEVEL_LOG
,
36 source
.pp_var(), message
.pp_var());