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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 // Install theme once and undo to verify we go back to default theme. | 67 // Install theme once and undo to verify we go back to default theme. |
68 base::FilePath theme_crx = PackExtension(test_data_dir_.AppendASCII("theme")); | 68 base::FilePath theme_crx = PackExtension(test_data_dir_.AppendASCII("theme")); |
69 ASSERT_TRUE(InstallExtensionWithUIAutoConfirm(theme_crx, 1, browser())); | 69 ASSERT_TRUE(InstallExtensionWithUIAutoConfirm(theme_crx, 1, browser())); |
70 const Extension* theme = GetTheme(); | 70 const Extension* theme = GetTheme(); |
71 ASSERT_TRUE(theme); | 71 ASSERT_TRUE(theme); |
72 std::string theme_id = theme->id(); | 72 std::string theme_id = theme->id(); |
73 VerifyThemeInfoBarAndUndoInstall(); | 73 VerifyThemeInfoBarAndUndoInstall(); |
74 ASSERT_EQ(NULL, GetTheme()); | 74 ASSERT_EQ(NULL, GetTheme()); |
75 | 75 |
76 // Set the same theme twice and undo to verify we go back to default theme. | 76 // Set the same theme twice and undo to verify we go back to default theme. |
77 // We set the |expected_change| to zero in these 'InstallExtensionWithUI' | 77 ASSERT_TRUE(InstallExtensionWithUIAutoConfirm(theme_crx, 1, browser())); |
78 // calls since the theme has already been installed above and this is an | |
79 // overinstall to set the active theme. | |
80 ASSERT_TRUE(InstallExtensionWithUIAutoConfirm(theme_crx, 0, browser())); | |
81 theme = GetTheme(); | 78 theme = GetTheme(); |
82 ASSERT_TRUE(theme); | 79 ASSERT_TRUE(theme); |
83 ASSERT_EQ(theme_id, theme->id()); | 80 ASSERT_EQ(theme_id, theme->id()); |
84 ASSERT_TRUE(InstallExtensionWithUIAutoConfirm(theme_crx, 0, browser())); | 81 ASSERT_TRUE(InstallExtensionWithUIAutoConfirm(theme_crx, 0, browser())); |
85 theme = GetTheme(); | 82 theme = GetTheme(); |
86 ASSERT_TRUE(theme); | 83 ASSERT_TRUE(theme); |
87 ASSERT_EQ(theme_id, theme->id()); | 84 ASSERT_EQ(theme_id, theme->id()); |
88 VerifyThemeInfoBarAndUndoInstall(); | 85 VerifyThemeInfoBarAndUndoInstall(); |
89 ASSERT_EQ(NULL, GetTheme()); | 86 ASSERT_EQ(NULL, GetTheme()); |
90 } | 87 } |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 EXPECT_EQ(num_normal_tabs + 1, browser()->tab_strip_model()->count()); | 154 EXPECT_EQ(num_normal_tabs + 1, browser()->tab_strip_model()->count()); |
158 WebContents* web_contents = | 155 WebContents* web_contents = |
159 browser()->tab_strip_model()->GetActiveWebContents(); | 156 browser()->tab_strip_model()->GetActiveWebContents(); |
160 ASSERT_TRUE(web_contents); | 157 ASSERT_TRUE(web_contents); |
161 EXPECT_TRUE(StartsWithASCII(web_contents->GetURL().spec(), | 158 EXPECT_TRUE(StartsWithASCII(web_contents->GetURL().spec(), |
162 "chrome://newtab/", false)); | 159 "chrome://newtab/", false)); |
163 } else { | 160 } else { |
164 // TODO(xiyuan): Figure out how to test extension installed bubble? | 161 // TODO(xiyuan): Figure out how to test extension installed bubble? |
165 } | 162 } |
166 } | 163 } |
OLD | NEW |