OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/string_util.h" |
5 #include "chrome/browser/extensions/extension_browsertest.h" | 6 #include "chrome/browser/extensions/extension_browsertest.h" |
6 #include "chrome/browser/extensions/extension_service.h" | 7 #include "chrome/browser/extensions/extension_service.h" |
7 #include "chrome/browser/extensions/theme_installed_infobar_delegate.h" | 8 #include "chrome/browser/extensions/theme_installed_infobar_delegate.h" |
8 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
9 #include "chrome/browser/tab_contents/tab_contents.h" | 10 #include "chrome/browser/tab_contents/tab_contents.h" |
10 #include "chrome/browser/ui/browser.h" | 11 #include "chrome/browser/ui/browser.h" |
11 #include "chrome/test/ui_test_utils.h" | 12 #include "chrome/test/ui_test_utils.h" |
12 | 13 |
13 namespace { | 14 namespace { |
14 | 15 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 theme = browser()->profile()->GetTheme(); | 54 theme = browser()->profile()->GetTheme(); |
54 ASSERT_TRUE(theme); | 55 ASSERT_TRUE(theme); |
55 ASSERT_EQ(theme_crx, theme->id()); | 56 ASSERT_EQ(theme_crx, theme->id()); |
56 ASSERT_TRUE(InstallExtensionWithUI(theme_path, 0)); | 57 ASSERT_TRUE(InstallExtensionWithUI(theme_path, 0)); |
57 theme = browser()->profile()->GetTheme(); | 58 theme = browser()->profile()->GetTheme(); |
58 ASSERT_TRUE(theme); | 59 ASSERT_TRUE(theme); |
59 ASSERT_EQ(theme_crx, theme->id()); | 60 ASSERT_EQ(theme_crx, theme->id()); |
60 VerifyThemeInfoBarAndUndoInstall(); | 61 VerifyThemeInfoBarAndUndoInstall(); |
61 ASSERT_EQ(NULL, browser()->profile()->GetTheme()); | 62 ASSERT_EQ(NULL, browser()->profile()->GetTheme()); |
62 } | 63 } |
| 64 |
| 65 IN_PROC_BROWSER_TEST_F(ExtensionInstallUIBrowserTest, |
| 66 AppInstallConfirmation) { |
| 67 int num_tabs = browser()->tab_count(); |
| 68 |
| 69 FilePath app_dir = test_data_dir_.AppendASCII("app"); |
| 70 ASSERT_TRUE(InstallExtensionWithUIAutoConfirm(app_dir, 1, |
| 71 browser()->profile())); |
| 72 |
| 73 EXPECT_EQ(num_tabs + 1, browser()->tab_count()); |
| 74 TabContents* tab_contents = browser()->GetSelectedTabContents(); |
| 75 ASSERT_TRUE(tab_contents); |
| 76 EXPECT_TRUE(StartsWithASCII(tab_contents->GetURL().spec(), |
| 77 "chrome://newtab/#app-id=", // id changes |
| 78 false)); |
| 79 } |
| 80 |
| 81 IN_PROC_BROWSER_TEST_F(ExtensionInstallUIBrowserTest, |
| 82 AppInstallConfirmation_Incognito) { |
| 83 Profile* incognito_profile = browser()->profile()->GetOffTheRecordProfile(); |
| 84 Browser* incognito_browser = Browser::GetOrCreateTabbedBrowser( |
| 85 incognito_profile); |
| 86 |
| 87 int num_incognito_tabs = incognito_browser->tab_count(); |
| 88 int num_normal_tabs = browser()->tab_count(); |
| 89 |
| 90 FilePath app_dir = test_data_dir_.AppendASCII("app"); |
| 91 ASSERT_TRUE(InstallExtensionWithUIAutoConfirm(app_dir, 1, |
| 92 incognito_profile)); |
| 93 |
| 94 EXPECT_EQ(num_incognito_tabs, incognito_browser->tab_count()); |
| 95 EXPECT_EQ(num_normal_tabs + 1, browser()->tab_count()); |
| 96 TabContents* tab_contents = browser()->GetSelectedTabContents(); |
| 97 ASSERT_TRUE(tab_contents); |
| 98 EXPECT_TRUE(StartsWithASCII(tab_contents->GetURL().spec(), |
| 99 "chrome://newtab/#app-id=", // id changes |
| 100 false)); |
| 101 } |
OLD | NEW |