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/string_util.h" | 5 #include "base/string_util.h" |
6 #include "chrome/app/chrome_command_ids.h" | 6 #include "chrome/app/chrome_command_ids.h" |
7 #include "chrome/browser/extensions/extension_browsertest.h" | 7 #include "chrome/browser/extensions/extension_browsertest.h" |
8 #include "chrome/browser/extensions/extension_service.h" | 8 #include "chrome/browser/extensions/extension_service.h" |
9 #include "chrome/browser/extensions/theme_installed_infobar_delegate.h" | 9 #include "chrome/browser/extensions/theme_installed_infobar_delegate.h" |
10 #include "chrome/browser/infobars/infobar_service.h" | 10 #include "chrome/browser/infobars/infobar_service.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 class ExtensionInstallUIBrowserTest : public ExtensionBrowserTest { | 24 class ExtensionInstallUIBrowserTest : public ExtensionBrowserTest { |
25 public: | 25 public: |
26 // Checks that a theme info bar is currently visible and issues an undo to | 26 // Checks that a theme info bar is currently visible and issues an undo to |
27 // revert to the previous theme. | 27 // revert to the previous theme. |
28 void VerifyThemeInfoBarAndUndoInstall() { | 28 void VerifyThemeInfoBarAndUndoInstall() { |
29 WebContents* web_contents = | 29 WebContents* web_contents = |
30 browser()->tab_strip_model()->GetActiveWebContents(); | 30 browser()->tab_strip_model()->GetActiveWebContents(); |
31 ASSERT_TRUE(web_contents); | 31 ASSERT_TRUE(web_contents); |
32 InfoBarService* infobar_service = | 32 InfoBarService* infobar_service = |
33 InfoBarService::FromWebContents(web_contents); | 33 InfoBarService::FromWebContents(web_contents); |
34 ASSERT_EQ(1U, infobar_service->GetInfoBarCount()); | 34 ASSERT_EQ(1U, infobar_service->infobar_count()); |
35 ConfirmInfoBarDelegate* delegate = infobar_service-> | 35 ConfirmInfoBarDelegate* delegate = |
36 GetInfoBarDelegateAt(0)->AsConfirmInfoBarDelegate(); | 36 infobar_service->infobar_at(0)->AsConfirmInfoBarDelegate(); |
37 ASSERT_TRUE(delegate); | 37 ASSERT_TRUE(delegate); |
38 delegate->Cancel(); | 38 delegate->Cancel(); |
39 ASSERT_EQ(0U, infobar_service->GetInfoBarCount()); | 39 ASSERT_EQ(0U, infobar_service->infobar_count()); |
40 } | 40 } |
41 | 41 |
42 // Install the given theme from the data dir and verify expected name. | 42 // Install the given theme from the data dir and verify expected name. |
43 void InstallThemeAndVerify(const char* theme_name, | 43 void InstallThemeAndVerify(const char* theme_name, |
44 const std::string& expected_name) { | 44 const std::string& expected_name) { |
45 const base::FilePath theme_path = test_data_dir_.AppendASCII(theme_name); | 45 const base::FilePath theme_path = test_data_dir_.AppendASCII(theme_name); |
46 ASSERT_TRUE(InstallExtensionWithUIAutoConfirm(theme_path, 1, browser())); | 46 ASSERT_TRUE(InstallExtensionWithUIAutoConfirm(theme_path, 1, browser())); |
47 const Extension* theme = GetTheme(); | 47 const Extension* theme = GetTheme(); |
48 ASSERT_TRUE(theme); | 48 ASSERT_TRUE(theme); |
49 ASSERT_EQ(theme->name(), expected_name); | 49 ASSERT_EQ(theme->name(), expected_name); |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 EXPECT_EQ(num_normal_tabs + 1, browser()->tab_strip_model()->count()); | 154 EXPECT_EQ(num_normal_tabs + 1, browser()->tab_strip_model()->count()); |
155 WebContents* web_contents = | 155 WebContents* web_contents = |
156 browser()->tab_strip_model()->GetActiveWebContents(); | 156 browser()->tab_strip_model()->GetActiveWebContents(); |
157 ASSERT_TRUE(web_contents); | 157 ASSERT_TRUE(web_contents); |
158 EXPECT_TRUE(StartsWithASCII(web_contents->GetURL().spec(), | 158 EXPECT_TRUE(StartsWithASCII(web_contents->GetURL().spec(), |
159 "chrome://newtab/", false)); | 159 "chrome://newtab/", false)); |
160 } else { | 160 } else { |
161 // TODO(xiyuan): Figure out how to test extension installed bubble? | 161 // TODO(xiyuan): Figure out how to test extension installed bubble? |
162 } | 162 } |
163 } | 163 } |
OLD | NEW |