Preparing myself for ISTQB, I found a bit odd many things in their textbooks. E.g. they call black box testing as functional testing when you are not concerned with structured but only observe the ouput based on inputs. But later they say that functional testing is done at levels..well, how can I do unit testing without the knowledge how it works if I can just see it (and must see it). It is white box but then it is in the conflict..
When you are doing unit testing, you do not care about the actual implementation of the solution, only that it gives the expected results. The difference being the level of unit that you are testing. If you are testing a class, you are not making sure that internal methods are called but that the correct response is returned. How the unit gets the response is not what you are testing for.
The different levels of testing cover the interaction and logic of the pieces of your implementation but are agnostic of what they actually are.
UPDATE Generally, developers do fine grain unit testing. However, even a tester can do lower level unit testing. Focusing on specific pieces of an operation, for example sending data to the server themselves rather than through the web interface (removing the web interface from the unit). Or for testing the web interface, spoofing the response provided so that you are able to test its behavior in isolation.
Knowing the implementation would allow you to determine the lower level 'units', however the tests themselves do not know anything about the actual details of the solution.
You can do black box or white box testing at any level of abstraction. Consider the following function:
A black box test would check that you got the right answer. A white box test would also check that
The next level of abstraction up might have a function like:
A black box test at this layer would check certain values precalculated to be in or out of range. A white box test would also check that
The vast majority of the time, unit tests should not care about the implementation at all. i.e. you should be doing black box tests. Often white box unit tests are unavoidable, but they should be minimized, so the coupling of your tests to your implementation is minimized.