| 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/string_util.h" | 5 #include "base/string_util.h" |
| 6 #include "chrome/browser/extensions/extension_browsertest.h" | 6 #include "chrome/browser/extensions/extension_browsertest.h" |
| 7 #include "chrome/browser/extensions/extension_service.h" | 7 #include "chrome/browser/extensions/extension_service.h" |
| 8 #include "chrome/browser/extensions/theme_installed_infobar_delegate.h" | 8 #include "chrome/browser/extensions/theme_installed_infobar_delegate.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 int num_tabs = browser()->tab_count(); | 102 int num_tabs = browser()->tab_count(); |
| 103 | 103 |
| 104 FilePath app_dir = test_data_dir_.AppendASCII("app"); | 104 FilePath app_dir = test_data_dir_.AppendASCII("app"); |
| 105 ASSERT_TRUE(InstallExtensionWithUIAutoConfirm(app_dir, 1, | 105 ASSERT_TRUE(InstallExtensionWithUIAutoConfirm(app_dir, 1, |
| 106 browser()->profile())); | 106 browser()->profile())); |
| 107 | 107 |
| 108 EXPECT_EQ(num_tabs + 1, browser()->tab_count()); | 108 EXPECT_EQ(num_tabs + 1, browser()->tab_count()); |
| 109 TabContents* tab_contents = browser()->GetSelectedTabContents(); | 109 TabContents* tab_contents = browser()->GetSelectedTabContents(); |
| 110 ASSERT_TRUE(tab_contents); | 110 ASSERT_TRUE(tab_contents); |
| 111 EXPECT_TRUE(StartsWithASCII(tab_contents->GetURL().spec(), | 111 EXPECT_TRUE(StartsWithASCII(tab_contents->GetURL().spec(), |
| 112 "chrome://newtab/#app-id=", // id changes | 112 "chrome://newtab/", false)); |
| 113 false)); | |
| 114 } | 113 } |
| 115 | 114 |
| 116 IN_PROC_BROWSER_TEST_F(ExtensionInstallUIBrowserTest, | 115 IN_PROC_BROWSER_TEST_F(ExtensionInstallUIBrowserTest, |
| 117 AppInstallConfirmation_Incognito) { | 116 AppInstallConfirmation_Incognito) { |
| 118 Profile* incognito_profile = browser()->profile()->GetOffTheRecordProfile(); | 117 Profile* incognito_profile = browser()->profile()->GetOffTheRecordProfile(); |
| 119 Browser* incognito_browser = Browser::GetOrCreateTabbedBrowser( | 118 Browser* incognito_browser = Browser::GetOrCreateTabbedBrowser( |
| 120 incognito_profile); | 119 incognito_profile); |
| 121 | 120 |
| 122 int num_incognito_tabs = incognito_browser->tab_count(); | 121 int num_incognito_tabs = incognito_browser->tab_count(); |
| 123 int num_normal_tabs = browser()->tab_count(); | 122 int num_normal_tabs = browser()->tab_count(); |
| 124 | 123 |
| 125 FilePath app_dir = test_data_dir_.AppendASCII("app"); | 124 FilePath app_dir = test_data_dir_.AppendASCII("app"); |
| 126 ASSERT_TRUE(InstallExtensionWithUIAutoConfirm(app_dir, 1, | 125 ASSERT_TRUE(InstallExtensionWithUIAutoConfirm(app_dir, 1, |
| 127 incognito_profile)); | 126 incognito_profile)); |
| 128 | 127 |
| 129 EXPECT_EQ(num_incognito_tabs, incognito_browser->tab_count()); | 128 EXPECT_EQ(num_incognito_tabs, incognito_browser->tab_count()); |
| 130 EXPECT_EQ(num_normal_tabs + 1, browser()->tab_count()); | 129 EXPECT_EQ(num_normal_tabs + 1, browser()->tab_count()); |
| 131 TabContents* tab_contents = browser()->GetSelectedTabContents(); | 130 TabContents* tab_contents = browser()->GetSelectedTabContents(); |
| 132 ASSERT_TRUE(tab_contents); | 131 ASSERT_TRUE(tab_contents); |
| 133 EXPECT_TRUE(StartsWithASCII(tab_contents->GetURL().spec(), | 132 EXPECT_TRUE(StartsWithASCII(tab_contents->GetURL().spec(), |
| 134 "chrome://newtab/#app-id=", // id changes | 133 "chrome://newtab/", false)); |
| 135 false)); | |
| 136 } | 134 } |
| OLD | NEW |