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

Side by Side Diff: chrome/browser/extensions/extension_input_method_apitest.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 "chrome/browser/extensions/extension_apitest.h" 5 #include "chrome/browser/extensions/extension_apitest.h"
6 6
7 #include "base/stringprintf.h" 7 #include "base/stringprintf.h"
8 #include "chrome/browser/chromeos/extensions/input_method_event_router.h" 8 #include "chrome/browser/chromeos/extensions/input_method_event_router.h"
9 #include "chrome/browser/chromeos/input_method/input_method_manager.h" 9 #include "chrome/browser/chromeos/input_method/input_method_manager.h"
10 #include "chrome/browser/extensions/extension_test_api.h" 10 #include "chrome/browser/extensions/extension_test_api.h"
11 #include "chrome/common/chrome_notification_types.h" 11 #include "chrome/common/chrome_notification_types.h"
12 #include "content/public/browser/notification_observer.h" 12 #include "content/public/browser/notification_observer.h"
13 #include "content/public/browser/notification_registrar.h" 13 #include "content/public/browser/notification_registrar.h"
14 #include "content/common/notification_service.h" 14 #include "content/public/browser/notification_service.h"
15 #include "testing/gtest/include/gtest/gtest.h" 15 #include "testing/gtest/include/gtest/gtest.h"
16 16
17 namespace { 17 namespace {
18 18
19 const char kNewInputMethod[] = "ru::rus"; 19 const char kNewInputMethod[] = "ru::rus";
20 const char kSetInputMethodMessage[] = "setInputMethod"; 20 const char kSetInputMethodMessage[] = "setInputMethod";
21 const char kSetInputMethodDone[] = "done"; 21 const char kSetInputMethodDone[] = "done";
22 22
23 // Class that listens for the JS message then changes input method and replies 23 // Class that listens for the JS message then changes input method and replies
24 // back. 24 // back.
25 class SetInputMethodListener : public content::NotificationObserver { 25 class SetInputMethodListener : public content::NotificationObserver {
26 public: 26 public:
27 // Creates listener, which should reply exactly |count_| times. 27 // Creates listener, which should reply exactly |count_| times.
28 explicit SetInputMethodListener(int count) : count_(count) { 28 explicit SetInputMethodListener(int count) : count_(count) {
29 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_TEST_MESSAGE, 29 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_TEST_MESSAGE,
30 NotificationService::AllSources()); 30 content::NotificationService::AllSources());
31 } 31 }
32 32
33 virtual ~SetInputMethodListener() { 33 virtual ~SetInputMethodListener() {
34 EXPECT_EQ(0, count_); 34 EXPECT_EQ(0, count_);
35 } 35 }
36 36
37 // Implements the content::NotificationObserver interface. 37 // Implements the content::NotificationObserver interface.
38 virtual void Observe(int type, 38 virtual void Observe(int type,
39 const content::NotificationSource& source, 39 const content::NotificationSource& source,
40 const content::NotificationDetails& details) { 40 const content::NotificationDetails& details) {
(...skipping 19 matching lines...) Expand all
60 }; 60 };
61 61
62 } // namespace 62 } // namespace
63 63
64 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, InputMethodApiBasic) { 64 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, InputMethodApiBasic) {
65 // Two test, two calls. See JS code for more info. 65 // Two test, two calls. See JS code for more info.
66 SetInputMethodListener listener(2); 66 SetInputMethodListener listener(2);
67 67
68 ASSERT_TRUE(RunExtensionTest("input_method")) << message_; 68 ASSERT_TRUE(RunExtensionTest("input_method")) << message_;
69 } 69 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_input_api.cc ('k') | chrome/browser/extensions/extension_install_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698