| 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 "chrome/browser/ui/cocoa/extensions/extension_installed_bubble_controlle
r.h" |
| 6 |
| 5 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
| 6 #include <stddef.h> | 8 #include <stddef.h> |
| 7 | 9 |
| 10 #include <memory> |
| 11 |
| 8 #include "base/command_line.h" | 12 #include "base/command_line.h" |
| 9 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
| 10 #include "base/files/file_util.h" | 14 #include "base/files/file_util.h" |
| 11 #include "base/macros.h" | 15 #include "base/macros.h" |
| 12 #include "base/memory/scoped_ptr.h" | |
| 13 #include "base/path_service.h" | 16 #include "base/path_service.h" |
| 14 #include "base/values.h" | 17 #include "base/values.h" |
| 15 #include "chrome/browser/extensions/api/commands/command_service.h" | 18 #include "chrome/browser/extensions/api/commands/command_service.h" |
| 16 #include "chrome/browser/extensions/extension_service.h" | 19 #include "chrome/browser/extensions/extension_service.h" |
| 17 #include "chrome/browser/extensions/test_extension_system.h" | 20 #include "chrome/browser/extensions/test_extension_system.h" |
| 18 #include "chrome/browser/ui/browser_window.h" | 21 #include "chrome/browser/ui/browser_window.h" |
| 19 #import "chrome/browser/ui/cocoa/cocoa_profile_test.h" | 22 #import "chrome/browser/ui/cocoa/cocoa_profile_test.h" |
| 20 #import "chrome/browser/ui/cocoa/extensions/extension_installed_bubble_controlle
r.h" | |
| 21 #import "chrome/browser/ui/cocoa/info_bubble_window.h" | 23 #import "chrome/browser/ui/cocoa/info_bubble_window.h" |
| 22 #include "chrome/browser/ui/extensions/extension_installed_bubble.h" | 24 #include "chrome/browser/ui/extensions/extension_installed_bubble.h" |
| 23 #include "chrome/browser/ui/location_bar/location_bar.h" | 25 #include "chrome/browser/ui/location_bar/location_bar.h" |
| 24 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 26 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 25 #include "chrome/common/chrome_paths.h" | 27 #include "chrome/common/chrome_paths.h" |
| 26 #include "chrome/test/base/testing_profile.h" | 28 #include "chrome/test/base/testing_profile.h" |
| 27 #include "components/crx_file/id_util.h" | 29 #include "components/crx_file/id_util.h" |
| 28 #include "content/public/browser/site_instance.h" | 30 #include "content/public/browser/site_instance.h" |
| 29 #include "content/public/browser/web_contents.h" | 31 #include "content/public/browser/web_contents.h" |
| 30 #include "extensions/common/extension.h" | 32 #include "extensions/common/extension.h" |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 // Required to initialize the extension installed bubble. | 171 // Required to initialize the extension installed bubble. |
| 170 NSWindow* window_; // weak, owned by CocoaProfileTest. | 172 NSWindow* window_; // weak, owned by CocoaProfileTest. |
| 171 | 173 |
| 172 // The associated ExtensionService, owned by the ExtensionSystem. | 174 // The associated ExtensionService, owned by the ExtensionSystem. |
| 173 ExtensionService* extensionService_; | 175 ExtensionService* extensionService_; |
| 174 | 176 |
| 175 // Skeleton extension to be tested; reinitialized for each test. | 177 // Skeleton extension to be tested; reinitialized for each test. |
| 176 scoped_refptr<Extension> extension_; | 178 scoped_refptr<Extension> extension_; |
| 177 | 179 |
| 178 // The bubble that tests are run on. | 180 // The bubble that tests are run on. |
| 179 scoped_ptr<ExtensionInstalledBubble> extensionBubble_; | 181 std::unique_ptr<ExtensionInstalledBubble> extensionBubble_; |
| 180 | 182 |
| 181 // The icon_ to be loaded into the bubble window. | 183 // The icon_ to be loaded into the bubble window. |
| 182 SkBitmap icon_; | 184 SkBitmap icon_; |
| 183 | 185 |
| 184 DISALLOW_COPY_AND_ASSIGN(ExtensionInstalledBubbleControllerTest); | 186 DISALLOW_COPY_AND_ASSIGN(ExtensionInstalledBubbleControllerTest); |
| 185 }; | 187 }; |
| 186 | 188 |
| 187 // We don't want to just test the bounds of these frames, because that results | 189 // We don't want to just test the bounds of these frames, because that results |
| 188 // in a change detector test (and just duplicates the logic in the class). | 190 // in a change detector test (and just duplicates the logic in the class). |
| 189 // Instead, we do a few sanity checks. | 191 // Instead, we do a few sanity checks. |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 374 // Make sure there is always enough room for the icon and margin. | 376 // Make sure there is always enough room for the icon and margin. |
| 375 int minHeight = extension_installed_bubble::kIconSize + | 377 int minHeight = extension_installed_bubble::kIconSize + |
| 376 (2 * extension_installed_bubble::kOuterVerticalMargin); | 378 (2 * extension_installed_bubble::kOuterVerticalMargin); |
| 377 EXPECT_GT(height, minHeight); | 379 EXPECT_GT(height, minHeight); |
| 378 | 380 |
| 379 // Make sure the "show me" link is visible. | 381 // Make sure the "show me" link is visible. |
| 380 EXPECT_FALSE([[controller appInstalledShortcutLink] isHidden]); | 382 EXPECT_FALSE([[controller appInstalledShortcutLink] isHidden]); |
| 381 | 383 |
| 382 [controller close]; | 384 [controller close]; |
| 383 } | 385 } |
| OLD | NEW |