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 "base/strings/string_util.h" | 6 #include "base/strings/string_util.h" |
7 #include "chrome/app/chrome_command_ids.h" | 7 #include "chrome/app/chrome_command_ids.h" |
8 #include "chrome/browser/chrome_notification_types.h" | 8 #include "chrome/browser/chrome_notification_types.h" |
9 #include "chrome/browser/extensions/extension_browsertest.h" | 9 #include "chrome/browser/extensions/extension_browsertest.h" |
10 #include "chrome/browser/extensions/extension_service.h" | 10 #include "chrome/browser/extensions/extension_service.h" |
11 #include "chrome/browser/infobars/confirm_infobar_delegate.h" | 11 #include "chrome/browser/infobars/confirm_infobar_delegate.h" |
12 #include "chrome/browser/infobars/infobar.h" | 12 #include "chrome/browser/infobars/infobar.h" |
| 13 #include "chrome/browser/infobars/infobar_manager.h" |
13 #include "chrome/browser/infobars/infobar_service.h" | 14 #include "chrome/browser/infobars/infobar_service.h" |
14 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
15 #include "chrome/browser/themes/theme_service.h" | 16 #include "chrome/browser/themes/theme_service.h" |
16 #include "chrome/browser/themes/theme_service_factory.h" | 17 #include "chrome/browser/themes/theme_service_factory.h" |
17 #include "chrome/browser/ui/browser.h" | 18 #include "chrome/browser/ui/browser.h" |
18 #include "chrome/browser/ui/browser_commands.h" | 19 #include "chrome/browser/ui/browser_commands.h" |
19 #include "chrome/browser/ui/browser_finder.h" | 20 #include "chrome/browser/ui/browser_finder.h" |
20 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 21 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
21 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" | 22 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" |
22 #include "chrome/common/url_constants.h" | 23 #include "chrome/common/url_constants.h" |
(...skipping 12 matching lines...) Expand all Loading... |
35 class ExtensionInstallUIBrowserTest : public ExtensionBrowserTest { | 36 class ExtensionInstallUIBrowserTest : public ExtensionBrowserTest { |
36 public: | 37 public: |
37 // Checks that a theme info bar is currently visible and issues an undo to | 38 // Checks that a theme info bar is currently visible and issues an undo to |
38 // revert to the previous theme. | 39 // revert to the previous theme. |
39 void VerifyThemeInfoBarAndUndoInstall() { | 40 void VerifyThemeInfoBarAndUndoInstall() { |
40 WebContents* web_contents = | 41 WebContents* web_contents = |
41 browser()->tab_strip_model()->GetActiveWebContents(); | 42 browser()->tab_strip_model()->GetActiveWebContents(); |
42 ASSERT_TRUE(web_contents); | 43 ASSERT_TRUE(web_contents); |
43 InfoBarService* infobar_service = | 44 InfoBarService* infobar_service = |
44 InfoBarService::FromWebContents(web_contents); | 45 InfoBarService::FromWebContents(web_contents); |
45 ASSERT_EQ(1U, infobar_service->infobar_count()); | 46 ASSERT_EQ(1U, infobar_service->infobar_manager().infobar_count()); |
46 ConfirmInfoBarDelegate* delegate = | 47 ConfirmInfoBarDelegate* delegate = infobar_service->infobar_manager() |
47 infobar_service->infobar_at(0)->delegate()->AsConfirmInfoBarDelegate(); | 48 .infobar_at(0) |
| 49 ->delegate() |
| 50 ->AsConfirmInfoBarDelegate(); |
48 ASSERT_TRUE(delegate); | 51 ASSERT_TRUE(delegate); |
49 delegate->Cancel(); | 52 delegate->Cancel(); |
50 ASSERT_EQ(0U, infobar_service->infobar_count()); | 53 ASSERT_EQ(0U, infobar_service->infobar_manager().infobar_count()); |
51 } | 54 } |
52 | 55 |
53 // Install the given theme from the data dir and verify expected name. | 56 // Install the given theme from the data dir and verify expected name. |
54 void InstallThemeAndVerify(const char* theme_name, | 57 void InstallThemeAndVerify(const char* theme_name, |
55 const std::string& expected_name) { | 58 const std::string& expected_name) { |
56 // If there is already a theme installed, the current theme should be | 59 // If there is already a theme installed, the current theme should be |
57 // disabled and the new one installed + enabled. | 60 // disabled and the new one installed + enabled. |
58 int expected_change = GetTheme() ? 0 : 1; | 61 int expected_change = GetTheme() ? 0 : 1; |
59 const base::FilePath theme_path = test_data_dir_.AppendASCII(theme_name); | 62 const base::FilePath theme_path = test_data_dir_.AppendASCII(theme_name); |
60 ASSERT_TRUE(InstallExtensionWithUIAutoConfirm(theme_path, expected_change, | 63 ASSERT_TRUE(InstallExtensionWithUIAutoConfirm(theme_path, expected_change, |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 std::string(), | 246 std::string(), |
244 extension_misc::kWebStoreAppId); | 247 extension_misc::kWebStoreAppId); |
245 EXPECT_EQ(app_id, last_reordered_extension_id_); | 248 EXPECT_EQ(app_id, last_reordered_extension_id_); |
246 | 249 |
247 // Now install the app. | 250 // Now install the app. |
248 const extensions::Extension* test_app = LoadExtension(app_dir); | 251 const extensions::Extension* test_app = LoadExtension(app_dir); |
249 ASSERT_TRUE(test_app); | 252 ASSERT_TRUE(test_app); |
250 EXPECT_TRUE(service->GetInstalledExtension(app_id)); | 253 EXPECT_TRUE(service->GetInstalledExtension(app_id)); |
251 EXPECT_EQ(app_id, test_app->id()); | 254 EXPECT_EQ(app_id, test_app->id()); |
252 } | 255 } |
OLD | NEW |