Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/memory/scoped_nsobject.h" | 8 #include "base/memory/scoped_nsobject.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #import "chrome/browser/ui/cocoa/task_manager_mac.h" | 10 #import "chrome/browser/ui/cocoa/task_manager_mac.h" |
| 11 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h" | 11 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h" |
| 12 #include "grit/generated_resources.h" | 12 #include "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 "third_party/skia/include/core/SkBitmap.h" | 16 #include "third_party/skia/include/core/SkBitmap.h" |
| 17 | 17 |
| 18 namespace { | 18 namespace { |
| 19 | 19 |
| 20 class TestResource : public TaskManager::Resource { | 20 class TestResource : public TaskManager::Resource { |
| 21 public: | 21 public: |
| 22 TestResource(const string16& title, pid_t pid) : title_(title), pid_(pid) {} | 22 TestResource(const string16& title, pid_t pid) : title_(title), pid_(pid) {} |
| 23 virtual string16 GetTitle() const OVERRIDE { return title_; } | 23 virtual string16 GetTitle() const OVERRIDE { return title_; } |
| 24 virtual string16 GetProfileName() const OVERRIDE { return string16(); } | 24 virtual string16 GetProfileName() const OVERRIDE { return string16(); } |
| 25 virtual SkBitmap GetIcon() const OVERRIDE { return SkBitmap(); } | 25 virtual SkBitmap GetIcon() const OVERRIDE { return SkBitmap(); } |
| 26 virtual base::ProcessHandle GetProcess() const OVERRIDE { return pid_; } | 26 virtual base::ProcessHandle GetProcess() const OVERRIDE { return pid_; } |
| 27 virtual int GetUniqueChildProcessId() const OVERRIDE { | |
| 28 // In reality the unique child process ID is not the actual process ID, | |
| 29 // but for testing purposes it shouldn't make difference. | |
| 30 return (int) base::GetCurrentProcId(); | |
|
Mark Mentovai
2012/04/04 18:21:32
Don’t use (C-style)casts, ever, anywhere. Use C++<
nasko
2012/04/04 19:31:24
Done.
| |
| 31 } | |
| 27 virtual Type GetType() const OVERRIDE { return RENDERER; } | 32 virtual Type GetType() const OVERRIDE { return RENDERER; } |
| 28 virtual bool SupportNetworkUsage() const OVERRIDE { return false; } | 33 virtual bool SupportNetworkUsage() const OVERRIDE { return false; } |
| 29 virtual void SetSupportNetworkUsage() OVERRIDE { NOTREACHED(); } | 34 virtual void SetSupportNetworkUsage() OVERRIDE { NOTREACHED(); } |
| 30 virtual void Refresh() OVERRIDE {} | 35 virtual void Refresh() OVERRIDE {} |
| 31 string16 title_; | 36 string16 title_; |
| 32 string16 profile_name_; | 37 string16 profile_name_; |
| 33 pid_t pid_; | 38 pid_t pid_; |
| 34 }; | 39 }; |
| 35 | 40 |
| 36 } // namespace | 41 } // namespace |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 109 NSIndexSet* selection = [table selectedRowIndexes]; | 114 NSIndexSet* selection = [table selectedRowIndexes]; |
| 110 ASSERT_EQ(1u, [selection count]); | 115 ASSERT_EQ(1u, [selection count]); |
| 111 EXPECT_EQ(1u, [selection firstIndex]); | 116 EXPECT_EQ(1u, [selection firstIndex]); |
| 112 | 117 |
| 113 // Releases the controller, which in turn deletes |bridge|. | 118 // Releases the controller, which in turn deletes |bridge|. |
| 114 [controller close]; | 119 [controller close]; |
| 115 | 120 |
| 116 task_manager.RemoveResource(&resource1); | 121 task_manager.RemoveResource(&resource1); |
| 117 task_manager.RemoveResource(&resource2); | 122 task_manager.RemoveResource(&resource2); |
| 118 } | 123 } |
| OLD | NEW |