OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/command_line.h" | 5 #include "base/command_line.h" |
6 #include "chrome/browser/chrome_notification_types.h" | 6 #include "chrome/browser/chrome_notification_types.h" |
7 #include "chrome/browser/extensions/extension_install_ui.h" | 7 #include "chrome/browser/extensions/extension_install_ui.h" |
8 #include "chrome/browser/extensions/extension_service.h" | 8 #include "chrome/browser/extensions/extension_service.h" |
9 #include "chrome/browser/extensions/startup_helper.h" | 9 #include "chrome/browser/extensions/startup_helper.h" |
10 #include "chrome/browser/extensions/webstore_installer_test.h" | 10 #include "chrome/browser/extensions/webstore_installer_test.h" |
| 11 #include "chrome/browser/infobars/infobar_manager.h" |
11 #include "chrome/browser/infobars/infobar_service.h" | 12 #include "chrome/browser/infobars/infobar_service.h" |
12 #include "chrome/browser/managed_mode/managed_user_service.h" | 13 #include "chrome/browser/managed_mode/managed_user_service.h" |
13 #include "chrome/browser/managed_mode/managed_user_service_factory.h" | 14 #include "chrome/browser/managed_mode/managed_user_service_factory.h" |
14 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
15 #include "chrome/browser/ui/browser.h" | 16 #include "chrome/browser/ui/browser.h" |
16 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 17 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
17 #include "chrome/common/chrome_switches.h" | 18 #include "chrome/common/chrome_switches.h" |
18 #include "chrome/common/pref_names.h" | 19 #include "chrome/common/pref_names.h" |
19 #include "chrome/test/base/in_process_browser_test.h" | 20 #include "chrome/test/base/in_process_browser_test.h" |
20 #include "chrome/test/base/test_switches.h" | 21 #include "chrome/test/base/test_switches.h" |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( | 194 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( |
194 switches::kAppsGalleryInstallAutoConfirmForTests, "accept"); | 195 switches::kAppsGalleryInstallAutoConfirmForTests, "accept"); |
195 | 196 |
196 ui_test_utils::NavigateToURL( | 197 ui_test_utils::NavigateToURL( |
197 browser(), GenerateTestServerUrl(kAppDomain, "install_prohibited.html")); | 198 browser(), GenerateTestServerUrl(kAppDomain, "install_prohibited.html")); |
198 | 199 |
199 RunTest("runTest"); | 200 RunTest("runTest"); |
200 | 201 |
201 // No error infobar should show up. | 202 // No error infobar should show up. |
202 WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); | 203 WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); |
203 InfoBarService* info_bar_service = InfoBarService::FromWebContents(contents); | 204 InfoBarManager& infobar_manager = |
204 EXPECT_EQ(info_bar_service->infobar_count(), 0u); | 205 InfoBarService::FromWebContents(contents)->infobar_manager(); |
| 206 EXPECT_EQ(infobar_manager.infobar_count(), 0u); |
205 } | 207 } |
206 | 208 |
207 // The unpack failure test needs to use a different install .crx, which is | 209 // The unpack failure test needs to use a different install .crx, which is |
208 // specified via a command-line flag, so it needs its own test subclass. | 210 // specified via a command-line flag, so it needs its own test subclass. |
209 class WebstoreStartupInstallUnpackFailureTest | 211 class WebstoreStartupInstallUnpackFailureTest |
210 : public WebstoreStartupInstallerTest { | 212 : public WebstoreStartupInstallerTest { |
211 public: | 213 public: |
212 virtual void SetUpCommandLine(base::CommandLine* command_line) OVERRIDE { | 214 virtual void SetUpCommandLine(base::CommandLine* command_line) OVERRIDE { |
213 WebstoreStartupInstallerTest::SetUpCommandLine(command_line); | 215 WebstoreStartupInstallerTest::SetUpCommandLine(command_line); |
214 | 216 |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 327 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
326 command_line->AppendSwitchASCII( | 328 command_line->AppendSwitchASCII( |
327 switches::kLimitedInstallFromWebstore, "2"); | 329 switches::kLimitedInstallFromWebstore, "2"); |
328 helper.LimitedInstallFromWebstore(*command_line, browser()->profile(), | 330 helper.LimitedInstallFromWebstore(*command_line, browser()->profile(), |
329 base::MessageLoop::QuitWhenIdleClosure()); | 331 base::MessageLoop::QuitWhenIdleClosure()); |
330 base::MessageLoop::current()->Run(); | 332 base::MessageLoop::current()->Run(); |
331 | 333 |
332 EXPECT_TRUE(saw_install()); | 334 EXPECT_TRUE(saw_install()); |
333 EXPECT_EQ(0, browser_open_count()); | 335 EXPECT_EQ(0, browser_open_count()); |
334 } | 336 } |
OLD | NEW |