| 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 #import <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
| 6 #include <stddef.h> | 6 #include <stddef.h> |
| 7 | 7 |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 #include "chrome/browser/ui/extensions/extension_installed_bubble.h" | 22 #include "chrome/browser/ui/extensions/extension_installed_bubble.h" |
| 23 #include "chrome/browser/ui/location_bar/location_bar.h" | 23 #include "chrome/browser/ui/location_bar/location_bar.h" |
| 24 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 24 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 25 #include "chrome/common/chrome_paths.h" | 25 #include "chrome/common/chrome_paths.h" |
| 26 #include "chrome/test/base/testing_profile.h" | 26 #include "chrome/test/base/testing_profile.h" |
| 27 #include "components/crx_file/id_util.h" | 27 #include "components/crx_file/id_util.h" |
| 28 #include "content/public/browser/site_instance.h" | 28 #include "content/public/browser/site_instance.h" |
| 29 #include "content/public/browser/web_contents.h" | 29 #include "content/public/browser/web_contents.h" |
| 30 #include "extensions/common/extension.h" | 30 #include "extensions/common/extension.h" |
| 31 #include "extensions/common/extension_builder.h" | 31 #include "extensions/common/extension_builder.h" |
| 32 #include "extensions/common/feature_switch.h" |
| 32 #include "extensions/common/manifest_constants.h" | 33 #include "extensions/common/manifest_constants.h" |
| 33 #include "extensions/common/value_builder.h" | 34 #include "extensions/common/value_builder.h" |
| 34 #import "third_party/ocmock/OCMock/OCMock.h" | 35 #import "third_party/ocmock/OCMock/OCMock.h" |
| 35 #include "third_party/ocmock/gtest_support.h" | 36 #include "third_party/ocmock/gtest_support.h" |
| 36 #include "ui/gfx/codec/png_codec.h" | 37 #include "ui/gfx/codec/png_codec.h" |
| 37 | 38 |
| 38 using extensions::Extension; | 39 using extensions::Extension; |
| 39 using extensions::DictionaryBuilder; | 40 using extensions::DictionaryBuilder; |
| 40 | 41 |
| 41 class ExtensionInstalledBubbleControllerTest : public CocoaProfileTest { | 42 class ExtensionInstalledBubbleControllerTest : public CocoaProfileTest { |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 EXPECT_GT(NSMinY(iconFrame), NSMinY(syncPromoFrame)); | 282 EXPECT_GT(NSMinY(iconFrame), NSMinY(syncPromoFrame)); |
| 282 EXPECT_GT(NSMinY(iconFrame), 0); | 283 EXPECT_GT(NSMinY(iconFrame), 0); |
| 283 EXPECT_EQ(NSMinY(syncPromoFrame), 0); | 284 EXPECT_EQ(NSMinY(syncPromoFrame), 0); |
| 284 | 285 |
| 285 [controller close]; | 286 [controller close]; |
| 286 } | 287 } |
| 287 | 288 |
| 288 // Test the layout of a bubble for an unpacked extension (which is not syncable) | 289 // Test the layout of a bubble for an unpacked extension (which is not syncable) |
| 289 // and verify that the page action preview is enabled. | 290 // and verify that the page action preview is enabled. |
| 290 TEST_F(ExtensionInstalledBubbleControllerTest, BubbleLayoutPageActionUnpacked) { | 291 TEST_F(ExtensionInstalledBubbleControllerTest, BubbleLayoutPageActionUnpacked) { |
| 292 // Tests legacy behavior. |
| 293 extensions::FeatureSwitch::ScopedOverride extension_action_override( |
| 294 extensions::FeatureSwitch::extension_action_redesign(), false); |
| 291 // Page actions need a web contents (for the location bar to not break). | 295 // Page actions need a web contents (for the location bar to not break). |
| 292 AddWebContents(); | 296 AddWebContents(); |
| 293 | 297 |
| 294 LocationBarTesting* locationBar = | 298 LocationBarTesting* locationBar = |
| 295 browser()->window()->GetLocationBar()->GetLocationBarForTesting(); | 299 browser()->window()->GetLocationBar()->GetLocationBarForTesting(); |
| 296 // To start, there should be no visible page actions. | 300 // To start, there should be no visible page actions. |
| 297 EXPECT_EQ(0, locationBar->PageActionVisibleCount()); | 301 EXPECT_EQ(0, locationBar->PageActionVisibleCount()); |
| 298 | 302 |
| 299 CreateExtension(PAGE_ACTION, true, extensions::Manifest::UNPACKED); | 303 CreateExtension(PAGE_ACTION, true, extensions::Manifest::UNPACKED); |
| 300 ExtensionInstalledBubbleController* controller = CreateController(); | 304 ExtensionInstalledBubbleController* controller = CreateController(); |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 // Make sure there is always enough room for the icon and margin. | 374 // Make sure there is always enough room for the icon and margin. |
| 371 int minHeight = extension_installed_bubble::kIconSize + | 375 int minHeight = extension_installed_bubble::kIconSize + |
| 372 (2 * extension_installed_bubble::kOuterVerticalMargin); | 376 (2 * extension_installed_bubble::kOuterVerticalMargin); |
| 373 EXPECT_GT(height, minHeight); | 377 EXPECT_GT(height, minHeight); |
| 374 | 378 |
| 375 // Make sure the "show me" link is visible. | 379 // Make sure the "show me" link is visible. |
| 376 EXPECT_FALSE([[controller appInstalledShortcutLink] isHidden]); | 380 EXPECT_FALSE([[controller appInstalledShortcutLink] isHidden]); |
| 377 | 381 |
| 378 [controller close]; | 382 [controller close]; |
| 379 } | 383 } |
| OLD | NEW |