I kind of believe that we need to implement the API the way it is designed; even if that makes no sense at all. At least it would be good to propose a better Power/Idle API soon as it should be quite easy to implement.
Kenneth On Tue, Sep 17, 2013 at 9:51 PM, Menard, Alexis <alexis.men...@intel.com> wrote: > Hi, > > I was fixing the remaining tests from the tct suite related to Power API and > I'm left with two failures which I'd like to discuss. > > Consider the Power API : > https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/power.html > > and these methods : > > void turnScreenOn () > void turnScreenOff () > setScreenBrightness() > > The two tests are failing because they're testing the API basically that way : > > turnScreenOn() > assert_true(isScreenOn()) > > Problem is that the underlaying C API we call (or even any other Power > management API I believe) is not a synchronous function call. It takes few ms > to change the brightness or to wake up/switch off the screen also because you > may need to change the power state and so on. > > I believe these TCT tests are covering the behaviour for the old WRT. If we > want to be compliant we need to behave the same and therefore emulate the > synchronous behaviour (btw I hope the SysApps API are better because OMG > these are terrible APIs). > > As we use the same C API as the ones in the old WRT I was curious on how the > people behind the old WRT solved it and here is the magic piece of code : > > void PowerManager::setScreenState(bool onoff){ > int ret = 0; > if( onoff ) > ret = pm_change_state(LCD_NORMAL); > else > ret = pm_change_state(LCD_OFF); > if( ret<0 ){ > LoggerE("Platform error while changing screen state %d", ret); > throw UnknownException("Platform error while changing screen state"); > } > > int timeout=100; > while(timeout--){ > if( isScreenOn() == onoff ) > break; > usleep(100000); > } > } > > So should we emulate the sync behaviour? If so, I believe that we can do > better than the piece of code above (by blocking the return of the fct while > we wait the state change callback from the platform) -> better suggestion? > > Software Engineer @ > Intel Open Source Technology Center > > _______________________________________________ > Crosswalk-dev mailing list > Crosswalk-dev@lists.crosswalk-project.org > https://lists.crosswalk-project.org/mailman/listinfo/crosswalk-dev -- Kenneth Rohde Christiansen Senior Engineer, WebKit, Qt, EFL Phone +45 4294 9458 / E-mail kenneth at webkit.org ﹆﹆﹆ _______________________________________________ Crosswalk-dev mailing list Crosswalk-dev@lists.crosswalk-project.org https://lists.crosswalk-project.org/mailman/listinfo/crosswalk-dev