| 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/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "chrome/browser/task_manager/resource_provider.h" | 9 #include "chrome/browser/task_manager/resource_provider.h" |
| 10 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h" | 10 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h" |
| 11 #import "chrome/browser/ui/cocoa/task_manager_mac.h" | 11 #import "chrome/browser/ui/cocoa/task_manager_mac.h" |
| 12 #include "chrome/grit/generated_resources.h" | 12 #include "chrome/grit/generated_resources.h" |
| 13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
| 14 #import "testing/gtest_mac.h" | 14 #import "testing/gtest_mac.h" |
| 15 #include "testing/platform_test.h" | 15 #include "testing/platform_test.h" |
| 16 #include "ui/gfx/image/image_skia.h" | 16 #include "ui/gfx/image/image_skia.h" |
| 17 | 17 |
| 18 namespace { | 18 namespace { |
| 19 | 19 |
| 20 class TestResource : public task_manager::Resource { | 20 class TestResource : public task_manager::Resource { |
| 21 public: | 21 public: |
| 22 TestResource(const base::string16& title, pid_t pid) | 22 TestResource(const base::string16& title, pid_t pid) |
| 23 : title_(title), pid_(pid) {} | 23 : title_(title), pid_(pid) {} |
| 24 virtual base::string16 GetTitle() const OVERRIDE { return title_; } | 24 virtual base::string16 GetTitle() const override { return title_; } |
| 25 virtual base::string16 GetProfileName() const OVERRIDE { | 25 virtual base::string16 GetProfileName() const override { |
| 26 return base::string16(); | 26 return base::string16(); |
| 27 } | 27 } |
| 28 virtual gfx::ImageSkia GetIcon() const OVERRIDE { return gfx::ImageSkia(); } | 28 virtual gfx::ImageSkia GetIcon() const override { return gfx::ImageSkia(); } |
| 29 virtual base::ProcessHandle GetProcess() const OVERRIDE { return pid_; } | 29 virtual base::ProcessHandle GetProcess() const override { return pid_; } |
| 30 virtual int GetUniqueChildProcessId() const OVERRIDE { | 30 virtual int GetUniqueChildProcessId() const override { |
| 31 // In reality the unique child process ID is not the actual process ID, | 31 // In reality the unique child process ID is not the actual process ID, |
| 32 // but for testing purposes it shouldn't make difference. | 32 // but for testing purposes it shouldn't make difference. |
| 33 return static_cast<int>(base::GetCurrentProcId()); | 33 return static_cast<int>(base::GetCurrentProcId()); |
| 34 } | 34 } |
| 35 virtual Type GetType() const OVERRIDE { return RENDERER; } | 35 virtual Type GetType() const override { return RENDERER; } |
| 36 virtual bool SupportNetworkUsage() const OVERRIDE { return false; } | 36 virtual bool SupportNetworkUsage() const override { return false; } |
| 37 virtual void SetSupportNetworkUsage() OVERRIDE { NOTREACHED(); } | 37 virtual void SetSupportNetworkUsage() override { NOTREACHED(); } |
| 38 virtual void Refresh() OVERRIDE {} | 38 virtual void Refresh() override {} |
| 39 base::string16 title_; | 39 base::string16 title_; |
| 40 base::string16 profile_name_; | 40 base::string16 profile_name_; |
| 41 pid_t pid_; | 41 pid_t pid_; |
| 42 }; | 42 }; |
| 43 | 43 |
| 44 } // namespace | 44 } // namespace |
| 45 | 45 |
| 46 class TaskManagerWindowControllerTest : public CocoaTest { | 46 class TaskManagerWindowControllerTest : public CocoaTest { |
| 47 }; | 47 }; |
| 48 | 48 |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 NSIndexSet* selection = [table selectedRowIndexes]; | 118 NSIndexSet* selection = [table selectedRowIndexes]; |
| 119 ASSERT_EQ(1u, [selection count]); | 119 ASSERT_EQ(1u, [selection count]); |
| 120 EXPECT_EQ(1u, [selection firstIndex]); | 120 EXPECT_EQ(1u, [selection firstIndex]); |
| 121 | 121 |
| 122 // Releases the controller, which in turn deletes |bridge|. | 122 // Releases the controller, which in turn deletes |bridge|. |
| 123 [controller close]; | 123 [controller close]; |
| 124 | 124 |
| 125 task_manager.RemoveResource(&resource1); | 125 task_manager.RemoveResource(&resource1); |
| 126 task_manager.RemoveResource(&resource2); | 126 task_manager.RemoveResource(&resource2); |
| 127 } | 127 } |
| OLD | NEW |