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 "content/public/test/test_browser_thread_bundle.h" |
13 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
14 #import "testing/gtest_mac.h" | 15 #import "testing/gtest_mac.h" |
15 #include "testing/platform_test.h" | 16 #include "testing/platform_test.h" |
16 #include "ui/gfx/image/image_skia.h" | 17 #include "ui/gfx/image/image_skia.h" |
17 | 18 |
18 namespace { | 19 namespace { |
19 | 20 |
20 class TestResource : public task_manager::Resource { | 21 class TestResource : public task_manager::Resource { |
21 public: | 22 public: |
22 TestResource(const base::string16& title, pid_t pid) | 23 TestResource(const base::string16& title, pid_t pid) |
(...skipping 12 matching lines...) Expand all Loading... |
35 void SetSupportNetworkUsage() override { NOTREACHED(); } | 36 void SetSupportNetworkUsage() override { NOTREACHED(); } |
36 void Refresh() override {} | 37 void Refresh() override {} |
37 base::string16 title_; | 38 base::string16 title_; |
38 base::string16 profile_name_; | 39 base::string16 profile_name_; |
39 pid_t pid_; | 40 pid_t pid_; |
40 }; | 41 }; |
41 | 42 |
42 } // namespace | 43 } // namespace |
43 | 44 |
44 class TaskManagerWindowControllerTest : public CocoaTest { | 45 class TaskManagerWindowControllerTest : public CocoaTest { |
| 46 content::TestBrowserThreadBundle thread_bundle_; |
45 }; | 47 }; |
46 | 48 |
47 // Test creation, to ensure nothing leaks or crashes. | 49 // Test creation, to ensure nothing leaks or crashes. |
48 TEST_F(TaskManagerWindowControllerTest, Init) { | 50 TEST_F(TaskManagerWindowControllerTest, Init) { |
49 TaskManager task_manager; | 51 TaskManager task_manager; |
50 TaskManagerMac* bridge(new TaskManagerMac(&task_manager)); | 52 TaskManagerMac* bridge(new TaskManagerMac(&task_manager)); |
51 TaskManagerWindowController* controller = bridge->cocoa_controller(); | 53 TaskManagerWindowController* controller = bridge->cocoa_controller(); |
52 | 54 |
53 // Releases the controller, which in turn deletes |bridge|. | 55 // Releases the controller, which in turn deletes |bridge|. |
54 [controller close]; | 56 [controller close]; |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 NSIndexSet* selection = [table selectedRowIndexes]; | 118 NSIndexSet* selection = [table selectedRowIndexes]; |
117 ASSERT_EQ(1u, [selection count]); | 119 ASSERT_EQ(1u, [selection count]); |
118 EXPECT_EQ(1u, [selection firstIndex]); | 120 EXPECT_EQ(1u, [selection firstIndex]); |
119 | 121 |
120 // Releases the controller, which in turn deletes |bridge|. | 122 // Releases the controller, which in turn deletes |bridge|. |
121 [controller close]; | 123 [controller close]; |
122 | 124 |
123 task_manager.RemoveResource(&resource1); | 125 task_manager.RemoveResource(&resource1); |
124 task_manager.RemoveResource(&resource2); | 126 task_manager.RemoveResource(&resource2); |
125 } | 127 } |
OLD | NEW |