OLD | NEW |
(Empty) | |
| 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. |
| 4 |
| 5 #include "ppapi/tests/test_console.h" |
| 6 |
| 7 #include "ppapi/cpp/module.h" |
| 8 #include "ppapi/tests/testing_instance.h" |
| 9 |
| 10 REGISTER_TEST_CASE(Console); |
| 11 |
| 12 TestConsole::TestConsole(TestingInstance* instance) |
| 13 : TestCase(instance), |
| 14 console_interface_(NULL) { |
| 15 } |
| 16 |
| 17 bool TestConsole::Init() { |
| 18 console_interface_ = static_cast<const PPB_Console*>( |
| 19 pp::Module::Get()->GetBrowserInterface(PPB_CONSOLE_INTERFACE)); |
| 20 return !!console_interface_; |
| 21 } |
| 22 |
| 23 void TestConsole::RunTests(const std::string& filter) { |
| 24 RUN_TEST(Smoke, filter); |
| 25 } |
| 26 |
| 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 |
| 30 // crashing. |
| 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, |
| 34 message.pp_var()); |
| 35 console_interface_->LogWithSource(instance()->pp_instance(), PP_LOGLEVEL_LOG, |
| 36 source.pp_var(), message.pp_var()); |
| 37 PASS(); |
| 38 } |
OLD | NEW |