Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(79)

Side by Side Diff: chrome/browser/autofill/autofill_browsertest.cc

Issue 8342048: Make NotificationService an interface in the content namespace, and switch callers to use it. Mov... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <string> 5 #include <string>
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/string16.h" 10 #include "base/string16.h"
(...skipping 10 matching lines...) Expand all
21 #include "chrome/browser/ui/browser_window.h" 21 #include "chrome/browser/ui/browser_window.h"
22 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 22 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
23 #include "chrome/common/chrome_notification_types.h" 23 #include "chrome/common/chrome_notification_types.h"
24 #include "chrome/common/render_messages.h" 24 #include "chrome/common/render_messages.h"
25 #include "chrome/renderer/translate_helper.h" 25 #include "chrome/renderer/translate_helper.h"
26 #include "chrome/test/base/in_process_browser_test.h" 26 #include "chrome/test/base/in_process_browser_test.h"
27 #include "chrome/test/base/ui_test_utils.h" 27 #include "chrome/test/base/ui_test_utils.h"
28 #include "content/browser/renderer_host/mock_render_process_host.h" 28 #include "content/browser/renderer_host/mock_render_process_host.h"
29 #include "content/browser/renderer_host/render_view_host.h" 29 #include "content/browser/renderer_host/render_view_host.h"
30 #include "content/browser/tab_contents/tab_contents.h" 30 #include "content/browser/tab_contents/tab_contents.h"
31 #include "content/public/browser/notification_service.h"
31 #include "content/test/test_url_fetcher_factory.h" 32 #include "content/test/test_url_fetcher_factory.h"
32 #include "testing/gtest/include/gtest/gtest.h" 33 #include "testing/gtest/include/gtest/gtest.h"
33 #include "ui/base/keycodes/keyboard_codes.h" 34 #include "ui/base/keycodes/keyboard_codes.h"
34 35
35 static const char* kDataURIPrefix = "data:text/html;charset=utf-8,"; 36 static const char* kDataURIPrefix = "data:text/html;charset=utf-8,";
36 static const char* kTestFormString = 37 static const char* kTestFormString =
37 "<form action=\"http://www.example.com/\" method=\"POST\">" 38 "<form action=\"http://www.example.com/\" method=\"POST\">"
38 "<label for=\"firstname\">First name:</label>" 39 "<label for=\"firstname\">First name:</label>"
39 " <input type=\"text\" id=\"firstname\"" 40 " <input type=\"text\" id=\"firstname\""
40 " onFocus=\"domAutomationController.send(true)\"><br>" 41 " onFocus=\"domAutomationController.send(true)\"><br>"
(...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after
660 661
661 // Simulate translation button press. 662 // Simulate translation button press.
662 infobar->Translate(); 663 infobar->Translate();
663 664
664 // Simulate the translate script being retrieved. 665 // Simulate the translate script being retrieved.
665 // Pass fake google.translate lib as the translate script. 666 // Pass fake google.translate lib as the translate script.
666 SimulateURLFetch(true); 667 SimulateURLFetch(true);
667 668
668 ui_test_utils::WindowedNotificationObserver translation_observer( 669 ui_test_utils::WindowedNotificationObserver translation_observer(
669 chrome::NOTIFICATION_PAGE_TRANSLATED, 670 chrome::NOTIFICATION_PAGE_TRANSLATED,
670 NotificationService::AllSources()); 671 content::NotificationService::AllSources());
671 672
672 // Simulate translation to kick onTranslateElementLoad. 673 // Simulate translation to kick onTranslateElementLoad.
673 // But right now, the call stucks here. 674 // But right now, the call stucks here.
674 // Once click the text field, it starts again. 675 // Once click the text field, it starts again.
675 ASSERT_TRUE(ui_test_utils::ExecuteJavaScript( 676 ASSERT_TRUE(ui_test_utils::ExecuteJavaScript(
676 render_view_host(), L"", 677 render_view_host(), L"",
677 L"cr.googleTranslate.onTranslateElementLoad();")); 678 L"cr.googleTranslate.onTranslateElementLoad();"));
678 679
679 // Simulate the render notifying the translation has been done. 680 // Simulate the render notifying the translation has been done.
680 translation_observer.Wait(); 681 translation_observer.Wait();
681 682
682 TryBasicFormFill(); 683 TryBasicFormFill();
683 } 684 }
OLDNEW
« no previous file with comments | « chrome/browser/autocomplete/extension_app_provider.cc ('k') | chrome/browser/autofill/autofill_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698