OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/scoped_nsobject.h" | 7 #include "base/scoped_nsobject.h" |
8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #import "chrome/browser/cocoa/task_manager_mac.h" | 9 #import "chrome/browser/cocoa/task_manager_mac.h" |
10 #import "chrome/browser/cocoa/cocoa_test_helper.h" | 10 #import "chrome/browser/cocoa/cocoa_test_helper.h" |
11 #include "grit/generated_resources.h" | 11 #include "grit/generated_resources.h" |
12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
13 #import "testing/gtest_mac.h" | 13 #import "testing/gtest_mac.h" |
14 #include "testing/platform_test.h" | 14 #include "testing/platform_test.h" |
15 #include "third_party/skia/include/core/SkBitmap.h" | 15 #include "third_party/skia/include/core/SkBitmap.h" |
16 | 16 |
17 namespace { | 17 namespace { |
18 | 18 |
19 class TestResource : public TaskManager::Resource { | 19 class TestResource : public TaskManager::Resource { |
20 public: | 20 public: |
21 TestResource(const string16& title, pid_t pid) : title_(title), pid_(pid) {} | 21 TestResource(const string16& title, pid_t pid) : title_(title), pid_(pid) {} |
22 virtual std::wstring GetTitle() const { return UTF16ToWide(title_); } | 22 virtual std::wstring GetTitle() const { return UTF16ToWide(title_); } |
23 virtual SkBitmap GetIcon() const { return SkBitmap(); } | 23 virtual SkBitmap GetIcon() const { return SkBitmap(); } |
24 virtual base::ProcessHandle GetProcess() const { return pid_; } | 24 virtual base::ProcessHandle GetProcess() const { return pid_; } |
| 25 virtual Type GetType() const { return RENDERER; } |
25 virtual bool SupportNetworkUsage() const { return false; } | 26 virtual bool SupportNetworkUsage() const { return false; } |
26 virtual void SetSupportNetworkUsage() { NOTREACHED(); } | 27 virtual void SetSupportNetworkUsage() { NOTREACHED(); } |
27 virtual void Refresh() {} | 28 virtual void Refresh() {} |
28 string16 title_; | 29 string16 title_; |
29 pid_t pid_; | 30 pid_t pid_; |
30 }; | 31 }; |
31 | 32 |
32 } // namespace | 33 } // namespace |
33 | 34 |
34 class TaskManagerWindowControllerTest : public CocoaTest { | 35 class TaskManagerWindowControllerTest : public CocoaTest { |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 NSIndexSet* selection = [table selectedRowIndexes]; | 106 NSIndexSet* selection = [table selectedRowIndexes]; |
106 ASSERT_EQ(1u, [selection count]); | 107 ASSERT_EQ(1u, [selection count]); |
107 EXPECT_EQ(1u, [selection firstIndex]); | 108 EXPECT_EQ(1u, [selection firstIndex]); |
108 | 109 |
109 // Releases the controller, which in turn deletes |bridge|. | 110 // Releases the controller, which in turn deletes |bridge|. |
110 [controller close]; | 111 [controller close]; |
111 | 112 |
112 task_manager.RemoveResource(&resource1); | 113 task_manager.RemoveResource(&resource1); |
113 task_manager.RemoveResource(&resource2); | 114 task_manager.RemoveResource(&resource2); |
114 } | 115 } |
OLD | NEW |