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