"Fossies" - the Fresh Open Source Software Archive

Member "google-gadgets-for-linux-0.11.2/extensions/linux_system_framework/tests/power_test.cc" (15 Mar 2009, 1440 Bytes) of package /linux/misc/old/google-gadgets-for-linux-0.11.2.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 /*
    2   Copyright 2008 Google Inc.
    3 
    4   Licensed under the Apache License, Version 2.0 (the "License");
    5   you may not use this file except in compliance with the License.
    6   You may obtain a copy of the License at
    7 
    8        http://www.apache.org/licenses/LICENSE-2.0
    9 
   10   Unless required by applicable law or agreed to in writing, software
   11   distributed under the License is distributed on an "AS IS" BASIS,
   12   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   13   See the License for the specific language governing permissions and
   14   limitations under the License.
   15 */
   16 
   17 #include <stdio.h>
   18 #include <ggadget/common.h>
   19 #include <ggadget/logger.h>
   20 #include <ggadget/tests/init_extensions.h>
   21 #include <unittest/gtest.h>
   22 #include "../power.h"
   23 
   24 using namespace ggadget;
   25 using namespace ggadget::framework;
   26 using namespace ggadget::framework::linux_system;
   27 
   28 TEST(Power, All) {
   29   Power battery;
   30   DLOG("Is Charging: %s", battery.IsCharging() ? "yes" : "no");
   31   DLOG("Is PluggedIn: %s", battery.IsPluggedIn() ? "yes" : "no");
   32   DLOG("Percent Remaining: %d", battery.GetPercentRemaining());
   33   DLOG("Time Remaining: %d", battery.GetTimeRemaining());
   34   DLOG("Time Total: %d", battery.GetTimeTotal());
   35 }
   36 
   37 int main(int argc, char **argv) {
   38   testing::ParseGTestFlags(&argc, argv);
   39 
   40   static const char *kExtensions[] = {
   41     "libxml2_xml_parser/libxml2-xml-parser",
   42   };
   43   INIT_EXTENSIONS(argc, argv, kExtensions);
   44 
   45   return RUN_ALL_TESTS();
   46 }