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