Hi there,

I started thinking about a few more test cases for the UI project
and I came along the BrowserManager [1].

I don't fully understand the idea of the "setBrowser" method.
It says that it "sets or replaces there browser for the given page
and all corresponding renderers".
Is there a reason for the "replace" part?
Currently there are three paths how the setBrowser method is reached:
 1. SarosViewBrowserVersion.createPartControl() ->
    BrowserCreator.createBrowser(MainPage) ->
    BrowserManager.setBrowser(MainPage, Browser)
 2. ShowAccountPage.function() ->
    DialogManager.showDialogWindow(AccountPage) ->
    EclipseDialogManager.createDialog(AccountPage) ->
    BrowserCreator.createBrowser(AccountPage) ->
    BrowserManager.setBrowser(AccountPage, Browser)
 3. (similar to 2., starting at ShowSessionWizard.function, using
    a SessionWizardPage object)

I guess these paths will be called multiple times during a plugins
lifetime. Every time "createBrowser" is called, a new Browser object
is created and passed to the BrowserManager.

Now consider the hypothetical calls (e.g. in a test case):
> mgr.setBrowser(mainPage, browserOne);
> mgr.setBrowser(mainPage, browserTwo);

If you look at the source code of BrowserManager.setBrowser, you'll see
that the old browserOne will indeed be replaced in the page-to-browser
mapping by the new browserTwo.
But what about the renderers?
According to the source code, each of the two renderers that the MainPage
uses (stateRenderer and accountRenderer) now has *both* browserOne and
browserTwo in its "browserList". This is because "setBrowser" only
calls "renderer.addBrowser()" but not "removeBrowser" -- which is called
every time a Browser is disposed.

So, again my question: What about the "replace" part of the "setBrowser"
method? It sounds like the old browser object (browserOne in the example
above) is "relieved of its duty", but until it is disposed, it will
still provided with the events generated by the renderers.

Or in other words: What would be valid test cases?
Is the example above simply a non-correct usage of the BrowserManager?

Cheers,
Franz

[1] 
https://github.com/saros-project/saros/blob/master@%7B2016-04-07%7D/de.fu_berlin.inf.dpp.ui/src/de/fu_berlin/inf/dpp/ui/manager/BrowserManager.java#L20
 


------------------------------------------------------------------------------
_______________________________________________
DPP-Devel mailing list
DPP-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dpp-devel

Reply via email to