Saturday, August 8, 2009

[Gd] TotT: Testing GWT without GwtTest

| More

Google Testing Blog: TotT: Testing GWT without GwtTest

Because GWT (Google Web Toolkit) is new and exciting it's easy to forget the lessons on clean GUI code structure that have been accumulated over nearly thirty years.

GwtTest is good for testing UI-specific code in JavaScript. If you find yourself using GwtTest for testing non-ui client-side logic you may not have a clear View/Presenter separation. Separating the View and the Presenter allows for more modular, more easily tested code with shorter test times. Model View Presenter was introduced in another episode back in February. Here's how to apply it to a GWT app.

Defining terms:

  • Server – a completely standard backend with no dependency on GWT.
  • Model – the data model. May be shared between the client and server side, or if appropriate you might have a different model for the client side. It has no dependency on GWT.
  • View – the display. Classes in the view wrap GWT widgets, hiding them from the rest of your code. They contain no logic, no state, and are easy to mock.
  • Presenter – all the client side logic and state; it talks to the server and tells the view what to do. It uses RPC mechanisms from GWT but no widgets.

The Presenter, which contains all the interesting client-side code is fully testable in Java!

public void testRefreshPersonListButtonWasClicked() {
  IMocksControl easyMockContext = EasyMock.createControl()
  mockServer = easyMockContext.createMock(Server.class);
  mockView = easyMockContext.createMock(View.class);
  List franz = Lists.newArrayList(
      new Person("Franz", "Mayer"));
  mockView.addPerson(“Franz”, “Mayer”);


Testing failure cases is now as easy as changing expectations. By swapping in the following expectations, the above test goes from testing success to testing that after two server failures, we show an error message.

        .times(2); // Ensure the presenter tries twice
    “Sorry, please try again later”));

You'll still need an end-to-end test. But all your logic can be tested in small and fast tests.

The Source Code for the Matchers is open-sourced and can be downloaded here: -

Consider using Test Driven Development (TDD) to develop the presenter. It tends to result in higher test coverage, faster and more relevant tests, as well as a better code structure.

This week's episode by David Morgan, Christopher Semturs and Nicolas Wettstein based in Zürich, Switzerland – having a real Mountain View

Toilet-friendly version


Friday, August 7, 2009

[Gd] Dev Channel Update: Fixes and Plugins

| More

Google Chrome Releases: Dev Channel Update: Fixes and Plugins

3.0.197.x has been released to the dev channel with the following changes:

Windows / All Builds  (
  • Crash fixes
  • Bug 2993: Fix tabs getting "stuck" to your mouse and dragged out when under system load [r22024].
  • Bug 60: Make downloads removable from download shelf and download list [r22138].
  • Bug 17697: Properly unescape past searches in the Omnibox dropdown [r22167].
  • Bug 3641: Setting Chrome as default browser on multiple accounts in Vista should work [r22282].
  • Tweaks for new New Tab Page [r22316], [r22320], [r22337], [r22388], [r22428].
  • Bug 8037: Use jumplists on Windows 7 [r22375].
  • Bug 998518271: Fixes for proxy users [r22430].
  • Rich text editors can now remove <s>, <u> and <strike> tags [Webkit r46286].

Linux  (
  • Default to showing the custom Chrome frame for most users [r22193].
  • Bug 15952: Use Linux native-looking title bar buttons. 
  • Many plugin fixes; fewer crashes [r21992], [r22037], [r22083] and Gmail no longer hangs [r22165].
  • GTK theme mode no longer fails to display the back button on recent Linux distros [r22242].
  • GTK themed location bar now matches theme text color (fix for dark themes) [r22018].
  • Match GTK's font hinting settings [r22411].

Mac  (
  • Bug 17555: Fix for a particularly common crash on Mac.
  • Bug 11952: Support input method editors (IMEs).
  • Enabled plugin support by default [r22209].


  • Bugs 18140 and 18472: Fix for crashes. 
  • Added a mole expand/collapse API, callable from a toolstrip [r22382].
  • Fix a bug where content scripts that are supposed to match all pages don't match hosts that are IP addresses [r22260].
  • Delay loading of toolstrips until the background page is ready [r22302].
  • First cut at the final extension installation prompt on Windows [r22368].
  • Experimental support for Databases and DOM Storage when extensions are enabled [r22452 and r22407].
  • Beginnings of extension shelf for linux [r22439].
Known issues:
  • (Mac) Flash can use a lot of CPU.
  • (Mac) Bug 18203:  Mouse clicks on Flash content often doesn't work. (Try middle-click as a workaround.)
  • (Mac) Bug 18666: Page Up/Down and Cursor Up/Down no longer scroll page content.
More details about additional changes are available in the svn log of all revisions.

You can find out about getting on the Dev channel here:

If you find new issues, please let us know by filing a bug at

Jonathan Conradt
Engineering Program Manager

Thursday, August 6, 2009

[Gd] Chromium Memory Usage

| More

Chromium Blog: Chromium Memory Usage

There's been some public discussion lately about memory usage in Google Chrome. We think about our memory usage quite a bit so we're happy to see other people paying attention too. This has been a topic of discussion before, but our multiprocess architecture makes measuring memory utilization difficult with the standard set of tools. The crux of the problem is that Chromium goes to great lengths to share memory between processes. However, that shared memory is difficult to account for in the Windows Task Manager. On Windows XP, using the default Task Manager measurement of memory leads to double counting. On Vista, using the default view leads to under counting.

There are a couple of more accurate ways to measure memory utilization in Chromium (or Google Chrome). The easiest is to crack open the task manager that is built into Chromium which tries to account for our memory usage more holistically. If you want even more detail, you can click on "Stats for nerds" which is a link to about:memory.

If you don't fully trust Chromium's task manager or about:memory, the gold standard for measuring memory usage is to look at the system's total commit charge before, during, and after using Chromium. It's a little tricky to get right because you'll need to shut down other services that may kick in while you are running your test. Here's the basic procedure:
  1. Shut down any unnecessary services
  2. Reboot your computer
  3. Using the windows task manager, measure the Total Commit Charge of the system*
  4. Run the application you are seeking to test, in this case, Chromium
  5. Measure the Total Commit Charge again
  6. Close the application
  7. Measure the Total Commit Charge one more time
  8. Subtract your first measurement from your second, and you should have the memory used by Chromium
  9. To validate your test, make sure that the first and last measurement are nearly identical
*On XP, Commit Charge shows up on the bottom of the Windows Task Manager. On Vista, look at the Performance tab of the Windows Task Manager and use the "Memory" number.

For more information on memory usage and how to measure it, check out the Memory Usage Backgrounder on

Posted by Brian Rakowski, Product Manager

[Gd] Python SDK version 1.2.4 released.

| More

Google App Engine Blog: Python SDK version 1.2.4 released.

We're psyched to release version 1.2.4 of the App Engine SDK for Python. Some highlights of what you'll find in this release:

For full details, please see the SdkReleaseNotes wiki page.

Downloads for Windows, Mac, and Linux are available on the Downloads page. This SDK update was for the Python runtime, so please post your feedback in the Python runtime discussion group.

We'd also like to draw your attention to two new articles from App Engine team members:


[Gd] How do you use Webmaster Tools? Share your stories and become a YouTube star!

| More

Official Google Webmaster Central Blog: How do you use Webmaster Tools? Share your stories and become a YouTube star!

Our greatest resource is the webmaster community, and here at Webmaster Central we're constantly impressed by the knowledge and expertise we see among webmasters: real-life SEOs, bloggers, online retailers, and all those other people creating great online content.

How do real-life webmasters actually use Webmaster Tools? We'd love to know, and we'd like to showcase some real-life examples for the rest of the community. Create a video telling your story, and upload it via the gadget in our Help Center. We'll highlight the best on our Webmaster Central YouTube channel, and even embed some in relevant Help Center articles (with full credit to you, of course).

To share your stories: Make a video, upload it to YouTube, then go to our Help Center, and submit your vid via our Help Center gadget. Our full guidelines give more information, but here is a summary of the key points:

  • Keep the video short; 3-5 minutes is ideal. Think small: a short video is a good way to showcase your use of - for example - Top Search Queries, but not long enough to highlight your whole SEO strategy.
  • Focus on a real-life example of how you used a particular feature. For example, you could show how you used link data to research your brand, or crawl errors to diagnose problems with your site structure. Do you have a great tip or recommendation?
  • Upload your video before September 30.
  • White hats are recommended. They show up better on screen.

Written by Michael Wyszomierski and Ríona MacNamara

[Gd] Writing custom Property classes

| More

Google App Engine Blog: Writing custom Property classes

The App Engine datastore API comes with a wide range of Property classes you can use to represent properties on your datastore models. Occasionally, though, you'd like to do something that the designers didn't think of. Fortunately, it's really easy to extend the Datastore API with custom Property classes. In this blog post, we'll demonstrate how to write your own Property class to store Python's decimal data type.

The Property interface is documented here, but there are two essential methods our DecimalProperty must override: get_value_for_datastore, and make_value_from_datastore. We also need to declare one field, data_type, that specifies the data type our property class will contain. Let's start with a straightforward implementation:

class DecimalProperty(db.Property):
data_type = decimal.Decimal

def get_value_for_datastore(self, model_instance):
return str(super(DecimalProperty, self).get_value_for_datastore(model_instance))

def make_value_from_datastore(self, value):
return decimal.Decimal(value)

Note that in the case of get_value_for_datastore, we used super to call the parent class implementation, which handles the details of actually storing and retrieving the data stored in the model. We then simply convert the value to a string for storage in the datastore. In make_value_from_datastore, we reconstruct a Decimal object from the stored string.

That's all that's required for a basic property class! There is something missing from our example, though: We don't perform any validation to make sure that the user actually passed in a Decimal object. To do that, we override the validate method:

def validate(self, value):
value = super(DecimalProperty, self).validate(value)
if value is None or isinstance(value, decimal.Decimal):
return value
elif isinstance(value, basestring):
return decimal.Decimal(value)
raise db.BadValueError("Property %s must be a Decimal or string." %

Again we start by calling the parent class's implementation, which performs some basic validity checks. Then we check if the value is a Decimal - in which case we return it - or a string, in which case we convert it to a decimal and return it. If the value is invalid, we raise a BadValueError.

Using our property class is as simple as using any other one:

class MyModel(db.Model):
a_decimal = DecimalProperty()

model = MyModel()
model.a_decimal = decimal.Decimal("123.45")

For a more in depth treatment of writing your own property class, see the article by Rafe Kaplan, Extending Model Properties.

Posted by Nick Johnson, App Engine Team

[Gd] Advanced Q&A from (the appropriately-named) SMX Advanced

| More

Official Google Webmaster Central Blog: Advanced Q&A from (the appropriately-named) SMX Advanced

Webmaster Level: Intermediate to Advanced

Earlier this summer SMX Advanced landed once again in our fair city—Seattle—and it was indeed advanced. I got a number of questions at some Q&A panels that I had to go back and do a little research on. Here, as promised, are answers:

Q. We hear that Google's now doing a better job of indexing Flash content. If I have a Flash file that pulls in content from an external file and the external file is blocked by robots.txt, will that content be indexed in the Flash (which is not blocked by robots.txt)? Or will Google not be able to index that content?

A. We won't be able to access that content if it's in a file that's disallowed by robots.txt; so even though that content would be visible to humans (via the Flash), search engine crawlers wouldn't be able to access it. For more details, see our blog post on indexing Flash that loads external resources.

Q. Sites that customize content based on user behavior or clickstream are becoming more common. If a user clicks through to my site from a search results page, can I customize the content of that page or redirect the user based on the terms in their search query? Or is that considered cloaking? For example, if someone searches for [vintage cameo pendants] but clicks on my site's general vintage jewelry page, can I redirect that user to my vintage cameo-specific page since I know that's what they were searching for?

A. If you're redirecting or returning different content to the user than what Googlebot would see on that URL (e.g., based on the referrer or query string), we consider that cloaking. If the searcher decided to click on the 'vintage jewelry' result, you should show them the page they clicked on even if you think a different page might be better. You can always link between related pages on your website (i.e., link to your 'vintage jewelry' page from your 'vintage cameos' page and vice versa, so that anyone landing on those pages from any source can cross-navigate); but we don't believe you should make that decision for the searcher.

Q. Even though it involves showing different content to different visitors, Google considers ethical website testing (such as A/B or multivariate testing) a legitimate practice that does not violate Google's guidelines. One reason for this is because, while search engines may only see the original content of the page and not the variations, there's also a percentage of human users who see that same content; so the technique doesn't specifically target search engines.

However, some testing services recommend running 100% of a site's traffic through the winning combination for awhile after an experiment has completed, to verify that conversion rates stay high. How does this fit in with Google's view of cloaking?

A. Running 100% of traffic through one combination for a brief period of time in order to verify your experiment's results is fine. However, as our article on this subject states, "if we find a site running a single non-original combination at 100% for a number of months... we may remove that site from our index." If you want to confirm the results of your experiment but are worried about "how long is too long," consider running a follow-up experiment in which you send most of your traffic through your winning combination while still sending a small percentage to the original page as a control. This is what Google recommends with its own testing tool, Website Optimizer.

Q. If the character encoding specified in a page's HTTP header is different from that specified in the <meta equiv="Content-Type"> tag, which one will Google pay attention to?

A. We take a look at both of these, and also do a bit of processing/guessing on our own based on the content of the page. Most major browsers prioritize the encoding specified in the HTTP header over that specified in the HTML, if both are valid but different. However, if you're aware that they're different, the best answer is to fix one of them!

Q. How does Google handle triple-byte UTF-8-encoded international characters in a URL (such as Chinese or Japanese characters)? These types of URLs break in some applications; is Google able to process them correctly? Does Google understand keywords that are encoded this way—that is, can you understand that is just as relevant to shoes as is?

A. We can correctly handle %-escaped UTF-8 characters in the URL path and in query parameters, and we understand keywords that are encoded in this way. For international characters in a domain name, we recommend using punycode rather than %-encoding, because some older browsers (such as IE6) don't support non-ASCII domain names.

Have a question of your own? Join our discussion forum.

Posted by Susan Moskwa, Webmaster Trends Analyst

Wednesday, August 5, 2009

[Gd] Every happy gadget is the same, every unhappy gadget is unhappy in it's own way

| More

iGoogle Developer Blog: Every happy gadget is the same, every unhappy gadget is unhappy in it's own way

Not so long ago we wrote about the need to keep your social gadgets robust to adversity. We received a lot of questions about how to detect when social conditions have broken down, and what to tell users when they have. So here's a quick cheatsheet for how to determine what might be interfering with the normal operation of your gadget, and what to do about each of them.
  1. The user is in a domain without canvas view.
    All gadgets that take advantage of canvas view should also be prepared to support those domains for which canvas view is not available. To confirm that a canvas view is available, you can insert a Content section without a view specified, as outlined in this blog post. If your gadget does not support a home view only environment, we suggest telling the user "This gadget requires a feature that is not available in your locale at this time. Please check back at a later date." For more on views, check out the iGoogle Developer Guide.

  2. The user is in a domain where OpenSocial is not available.
    If a user is in a domain where canvas view is available a good next step is to test whether that domain has access to OpenSocial functionality. A gadget can determine if the user is on an OpenSocial supported domain or not by calling gadgets.util.hasFeature('opensocial-0.8'), which will return true if the domain supports OpenSocial. If your gadget requires OpenSocial to operate correctly, we recommend you tell the user "This gadget requires a feature that is not available in your locale at this time. Please check back at a later date."

  3. The user is not signed in.
    Remember that a significant portion of iGoogle's users are not signed in and won't have any available social information to draw from. A gadget can determine if the user has signed in or not by making a request for the owner or viewer and checking the ID of the user. A logged out user is considered anonymous, and will have a viewer ID of -1. If your gadget requires access to OpenSocial information in order to operate we suggest you give users the message "This gadget cannot access the information it needs so that you can share or collaborate with friends. Please sign in to enable access." In many cases, of course, gadgets can still function even without social features. In that case - we suggest the message "This gadget lets you share and collaborate with friends on iGoogle. Sign in to use these features."

  4. The user has not enabled the gadget's social access.
    After installing a gadget a user will be prompted to enable that gadget to access their friend list and activity stream. If the gadget makes an OpenSocial request for information that the user has not enabled access to, it will fail with error code 403 (FORBIDDEN). If your gadget needs access to one or both of these datasets, we recommend the message "This gadget cannot access the information it needs so that you can share or collaborate with friends. Please adjust the gadget's settings to enable access." Similarly if your gadget can still function without access to these social features we recommend the message "This gadget lets you share and collaborate with friends on iGoogle. Please adjust the gadgets settings to use these features." Remember that all users will see your gadget displayed without social access at least once, so make sure your gadget handles this case gracefully!

  5. The user hasn't added any friends.
    Finally remember that most users will begin with no friends on their friends list. If your gadget needs friends in order operate normally, we recommend that you use tell your users "You can use this gadget to share and collaborate with friends on iGoogle. Share with friends." where you can link "share with friends" to the requestShareApp call, which allows users to simultaneously add friends and invite them to add your gadget.
By keeping these cases in mind you should be able to help ensure your users get the most out of the social functionality of your gadget. To see an example of how to detect these and other conditions in a live gadget, check out the newly updated Testing iGoogle State gadget.

Tyler Odean, Associate Product Manager, iGoogle Team

[Gd] Beta Update

| More

Google Chrome Releases: Beta Update

The Windows beta channel has been updated to

This release contains an updated new tab page, a revised omnibox, and themes support.

You can install the current Beta channel release from

Anthony Laforge
Google Chrome Program Manager

Tuesday, August 4, 2009

[Gd] Google Chrome Developer Tools for Eclipse Users

| More

Chromium Blog: Google Chrome Developer Tools for Eclipse Users

We recently announced the availability of developer tools for Google Chrome. We are now releasing ChromeDevTools, which enables JavaScript debugging using Eclipse.

You can set breakpoints, inspect variables and evaluate expressions all from within Eclipse. The screenshot shows the debugger in action stopped at a breakpoint.

The project is fully open sourced on a BSD-license and consists of two components, an SDK and a debugger. The SDK provides a Java API that enables communication with Google Chrome over TCP/IP. The debugger is an Eclipse plugin that uses the SDK and enables you to debug JavaScript running in Google Chrome from the Eclipse IDE.

We hope this project will help web app developers and welcome feedback as well as contributions.

Posted by Alexander Pavlov, Software Engineer

[Gd] AdWords Downtime: August 8, 10am-2pm PDT

| More

AdWords API Blog: AdWords Downtime: August 8, 10am-2pm PDT

We'll be performing routine system maintenance on Saturday, August 8 from approximately 10:00am to 2:00pm PDT. You won't be able to access AdWords or the API during this time frame, but your ads will continue to run as normal.

-Eric Koleda, AdWords API Team

Monday, August 3, 2009

[Gd] Google Wave Community Events

| More

Google Wave Developer Blog: Google Wave Community Events

While we've had a Wave developer event or two (or three!) here at the Googleplex, community groups are having an amazing number of them all over the world. The community-organized events are a great way to meet and work with local developers. Below are a handful of the ones we know about. (These events aren't Google sponsored, but we participate where and when possible. Follow the event links for details.)

Recent Events

7/18–7/19Bangkok Google Wave Hackathon——
7/22San Diego Google Wave HackathonSan Diego GTUG (Google Technology User Group)
7/25Bangalore GTUG Launch EventBangalore GTUG
7/27Tokyo Google Wave Weekend Hackathon (Japanese)——
7/30Sydney Wave User Group Inaugural EventSydney Wave User Group

Upcoming Events

8/1–8/2Düsseldorf Google Wave Hackathon (German)Düsseldorf GTUG (German)
8/3Bay Area Google Wave August MeetupBay Area Google Wave Meetup Group
8/7–8/9GTUG Campout: Silicon ValleySilicon Valley GTUG
8/8Canberra Google Wave Hackathon Day——
8/20San Francisco Google Wave August MeetupSan Francisco Google Wave Meetup Group

You can find a more complete list of events on the Google Code calendar. And, if you're planning an event of your own, spread the word! Click the Add an event button to add yours to the calendar.

Posted by Brian Kennish, Google Developer Advocate


[Gd] [Language][Update] - New Transliteration Languages

| More

Google AJAX API Alerts: [Language][Update] - New Transliteration Languages

The Transliteration API now supports Punjabi and Urdu.