github.com/ckxng/wakeup@v0.0.0-20190105202853-90356a5f5a15/src/tests/cef_test.go (about) 1 // Copyright (c) 2014 The cef2go authors. All rights reserved. 2 // License: BSD 3-clause. 3 // Website: https://github.com/CzarekTomczak/cef2go 4 5 // cef_test package tests the cef package. The tests 6 // had to be put to a separate package to speed up 7 // the running of tests. When the test was inside the 8 // cef package, then the cef package was recompiled 9 // each time, even though it was installed in GOPATH 10 // before running the test. And this took time and 11 // and slowed down the build process significantly. 12 package cef_test 13 14 import ( 15 "testing" 16 "cef" 17 "log" 18 "os" 19 ) 20 21 var Logger *log.Logger = log.New(os.Stdout, "[cef_test] ", log.Lshortfile) 22 23 func Test_WorkingDirectory(t *testing.T) { 24 // Change working directory while running tests, otherwise 25 // CEF may have troubles finding the resource pak files. 26 os.Chdir("./../../Release") 27 } 28 29 func Test_ExecuteProcess(t *testing.T) { 30 Logger.Println("Test_ExecuteProcess") 31 // If called for the browser process it will return 32 // immediately with a value of -1 33 code := cef.ExecuteProcess(nil) 34 Logger.Println("ExecuteProcess returned:", code) 35 } 36 37 func Test_Initialize(t *testing.T) { 38 Logger.Println("Test_Initialize") 39 settings := cef.Settings{} 40 init := cef.Initialize(settings) 41 Logger.Println("Initialize() returned:", init) 42 if init != 1 { 43 t.Errorf("Initialize() returned: %d", init) 44 } 45 } 46 47 func Test_Shutdown(t *testing.T) { 48 Logger.Println("Test_Shutdown") 49 cef.Shutdown() 50 }