OLD | NEW |
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 "base/stringprintf.h" | 5 #include "base/stringprintf.h" |
6 #if defined (OS_WIN) | 6 #if defined (OS_WIN) |
7 #include "base/win/windows_version.h" | 7 #include "base/win/windows_version.h" |
8 #endif // defined (OS_WIN) | 8 #endif // defined (OS_WIN) |
9 | 9 |
10 #include "chrome/browser/extensions/extension_apitest.h" | 10 #include "chrome/browser/extensions/extension_apitest.h" |
11 #include "chrome/browser/extensions/extension_webstore_private_api.h" | 11 #include "chrome/browser/extensions/extension_webstore_private_api.h" |
| 12 #include "chrome/common/chrome_notification_types.h" |
12 #include "chrome/common/chrome_switches.h" | 13 #include "chrome/common/chrome_switches.h" |
13 #include "chrome/test/ui_test_utils.h" | 14 #include "chrome/test/ui_test_utils.h" |
14 #include "content/common/notification_observer.h" | 15 #include "content/common/notification_observer.h" |
15 #include "content/common/notification_registrar.h" | 16 #include "content/common/notification_registrar.h" |
16 #include "content/common/notification_service.h" | 17 #include "content/common/notification_service.h" |
17 #include "content/common/notification_type.h" | |
18 #include "net/base/mock_host_resolver.h" | 18 #include "net/base/mock_host_resolver.h" |
19 | 19 |
20 // This is a helper class to let us automatically accept extension install | 20 // This is a helper class to let us automatically accept extension install |
21 // dialogs. | 21 // dialogs. |
22 class GalleryInstallApiTestObserver : | 22 class GalleryInstallApiTestObserver : |
23 public base::RefCounted<GalleryInstallApiTestObserver>, | 23 public base::RefCounted<GalleryInstallApiTestObserver>, |
24 public NotificationObserver { | 24 public NotificationObserver { |
25 public: | 25 public: |
26 GalleryInstallApiTestObserver() { | 26 GalleryInstallApiTestObserver() { |
27 registrar_.Add(this, | 27 registrar_.Add(this, |
28 NotificationType::EXTENSION_WILL_SHOW_CONFIRM_DIALOG, | 28 chrome::NOTIFICATION_EXTENSION_WILL_SHOW_CONFIRM_DIALOG, |
29 NotificationService::AllSources()); | 29 NotificationService::AllSources()); |
30 } | 30 } |
31 | 31 |
32 void InstallUIProceed(ExtensionInstallUI::Delegate* delegate) { | 32 void InstallUIProceed(ExtensionInstallUI::Delegate* delegate) { |
33 delegate->InstallUIProceed(); | 33 delegate->InstallUIProceed(); |
34 } | 34 } |
35 | 35 |
36 virtual void Observe(NotificationType type, | 36 virtual void Observe(int type, |
37 const NotificationSource& source, | 37 const NotificationSource& source, |
38 const NotificationDetails& details) OVERRIDE { | 38 const NotificationDetails& details) OVERRIDE { |
39 ExtensionInstallUI* prompt = Source<ExtensionInstallUI>(source).ptr(); | 39 ExtensionInstallUI* prompt = Source<ExtensionInstallUI>(source).ptr(); |
40 CHECK(prompt->delegate_); | 40 CHECK(prompt->delegate_); |
41 MessageLoop::current()->PostTask( | 41 MessageLoop::current()->PostTask( |
42 FROM_HERE, NewRunnableMethod( | 42 FROM_HERE, NewRunnableMethod( |
43 this, | 43 this, |
44 &GalleryInstallApiTestObserver::InstallUIProceed, | 44 &GalleryInstallApiTestObserver::InstallUIProceed, |
45 prompt->delegate_)); | 45 prompt->delegate_)); |
46 } | 46 } |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 ASSERT_TRUE(RunInstallTest("test.html")); | 114 ASSERT_TRUE(RunInstallTest("test.html")); |
115 ASSERT_TRUE(RunInstallTest("complete_without_begin.html")); | 115 ASSERT_TRUE(RunInstallTest("complete_without_begin.html")); |
116 ASSERT_TRUE(RunInstallTest("invalid_begin.html")); | 116 ASSERT_TRUE(RunInstallTest("invalid_begin.html")); |
117 | 117 |
118 if (RunningOnXP()) { | 118 if (RunningOnXP()) { |
119 LOG(INFO) << "Starting tests with user gesture checking"; | 119 LOG(INFO) << "Starting tests with user gesture checking"; |
120 } | 120 } |
121 BeginInstallFunction::SetIgnoreUserGestureForTests(false); | 121 BeginInstallFunction::SetIgnoreUserGestureForTests(false); |
122 ASSERT_TRUE(RunInstallTest("no_user_gesture.html")); | 122 ASSERT_TRUE(RunInstallTest("no_user_gesture.html")); |
123 } | 123 } |
OLD | NEW |