| 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 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/path_service.h" | 12 #include "base/path_service.h" |
| 13 #include "base/values.h" | 13 #include "base/values.h" |
| 14 #include "chrome/browser/extensions/extension_service.h" | 14 #include "chrome/browser/extensions/extension_service.h" |
| 15 #include "chrome/browser/extensions/test_extension_system.h" | 15 #include "chrome/browser/extensions/test_extension_system.h" |
| 16 #import "chrome/browser/ui/browser_window.h" | 16 #import "chrome/browser/ui/browser_window.h" |
| 17 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" | 17 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" |
| 18 #import "chrome/browser/ui/cocoa/extensions/extension_installed_bubble_controlle
r.h" | 18 #import "chrome/browser/ui/cocoa/extensions/extension_installed_bubble_controlle
r.h" |
| 19 #import "chrome/browser/ui/cocoa/info_bubble_window.h" | 19 #import "chrome/browser/ui/cocoa/info_bubble_window.h" |
| 20 #include "chrome/common/chrome_paths.h" | 20 #include "chrome/common/chrome_paths.h" |
| 21 #include "chrome/common/extensions/extension.h" | 21 #include "chrome/common/extensions/extension.h" |
| 22 #include "chrome/common/extensions/extension_manifest_constants.h" | 22 #include "extensions/common/manifest_constants.h" |
| 23 #include "third_party/ocmock/gtest_support.h" | 23 #include "third_party/ocmock/gtest_support.h" |
| 24 #import "third_party/ocmock/OCMock/OCMock.h" | 24 #import "third_party/ocmock/OCMock/OCMock.h" |
| 25 #include "ui/gfx/codec/png_codec.h" | 25 #include "ui/gfx/codec/png_codec.h" |
| 26 | 26 |
| 27 using extensions::Extension; | 27 using extensions::Extension; |
| 28 | 28 |
| 29 // ExtensionInstalledBubbleController with removePageActionPreview overridden | 29 // ExtensionInstalledBubbleController with removePageActionPreview overridden |
| 30 // to a no-op, because pageActions are not yet hooked up in the test browser. | 30 // to a no-op, because pageActions are not yet hooked up in the test browser. |
| 31 @interface ExtensionInstalledBubbleControllerForTest : | 31 @interface ExtensionInstalledBubbleControllerForTest : |
| 32 ExtensionInstalledBubbleController { | 32 ExtensionInstalledBubbleController { |
| 33 } | 33 } |
| 34 | 34 |
| 35 // Do nothing, because browser window is not set up with page actions | 35 // Do nothing, because browser window is not set up with page actions |
| 36 // for unit testing. | 36 // for unit testing. |
| 37 - (void)removePageActionPreview; | 37 - (void)removePageActionPreview; |
| 38 | 38 |
| 39 @end | 39 @end |
| 40 | 40 |
| 41 @implementation ExtensionInstalledBubbleControllerForTest | 41 @implementation ExtensionInstalledBubbleControllerForTest |
| 42 | 42 |
| 43 - (void)removePageActionPreview { } | 43 - (void)removePageActionPreview { } |
| 44 | 44 |
| 45 @end | 45 @end |
| 46 | 46 |
| 47 namespace keys = extension_manifest_keys; | 47 namespace keys = extensions::manifest_keys; |
| 48 | 48 |
| 49 class ExtensionInstalledBubbleControllerTest : public CocoaProfileTest { | 49 class ExtensionInstalledBubbleControllerTest : public CocoaProfileTest { |
| 50 | 50 |
| 51 public: | 51 public: |
| 52 virtual void SetUp() { | 52 virtual void SetUp() { |
| 53 CocoaProfileTest::SetUp(); | 53 CocoaProfileTest::SetUp(); |
| 54 ASSERT_TRUE(browser()); | 54 ASSERT_TRUE(browser()); |
| 55 window_ = browser()->window()->GetNativeWindow(); | 55 window_ = browser()->window()->GetNativeWindow(); |
| 56 icon_ = LoadTestIcon(); | 56 icon_ = LoadTestIcon(); |
| 57 CommandLine command_line(CommandLine::NO_PROGRAM); | 57 CommandLine command_line(CommandLine::NO_PROGRAM); |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 int minHeight = extension_installed_bubble::kIconSize + | 303 int minHeight = extension_installed_bubble::kIconSize + |
| 304 (2 * extension_installed_bubble::kOuterVerticalMargin); | 304 (2 * extension_installed_bubble::kOuterVerticalMargin); |
| 305 EXPECT_GT(height, minHeight); | 305 EXPECT_GT(height, minHeight); |
| 306 | 306 |
| 307 // Make sure the "show me" link is visible. | 307 // Make sure the "show me" link is visible. |
| 308 EXPECT_FALSE([[controller appInstalledShortcutLink] isHidden]); | 308 EXPECT_FALSE([[controller appInstalledShortcutLink] isHidden]); |
| 309 | 309 |
| 310 [controller close]; | 310 [controller close]; |
| 311 } | 311 } |
| 312 | 312 |
| OLD | NEW |