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