Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chrome/browser/task_manager/task_manager_util.h" | |
| 6 | |
| 7 #include <stddef.h> | |
| 8 | |
| 9 #include "base/macros.h" | |
| 10 #include "chrome/grit/generated_resources.h" | |
| 11 #include "testing/gtest/include/gtest/gtest.h" | |
| 12 | |
| 13 namespace task_manager { | |
| 14 | |
| 15 namespace util { | |
| 16 | |
| 17 TEST(TaskManagerUtilTest, GetMessagePrefixID) { | |
| 18 struct Configuration { | |
| 19 bool is_app; | |
| 20 bool is_extension; | |
| 21 bool is_incognito; | |
| 22 bool is_prerender; | |
| 23 bool is_background; | |
| 24 int expected_result; | |
| 25 }; | |
| 26 const Configuration configs[] = { | |
| 27 // Use implicit int->bool conversion to save space and keep alignment. | |
| 28 {1, 0, 0, 0, 1, IDS_TASK_MANAGER_BACKGROUND_PREFIX}, | |
| 29 {1, 0, 1, 0, 0, IDS_TASK_MANAGER_APP_INCOGNITO_PREFIX}, | |
| 30 {1, 0, 0, 0, 0, IDS_TASK_MANAGER_APP_PREFIX}, | |
| 31 {0, 1, 1, 0, 0, IDS_TASK_MANAGER_EXTENSION_INCOGNITO_PREFIX}, | |
| 32 {0, 1, 0, 0, 0, IDS_TASK_MANAGER_EXTENSION_PREFIX}, | |
| 33 {0, 0, 0, 1, 0, IDS_TASK_MANAGER_PRERENDER_PREFIX}, | |
| 34 {0, 0, 1, 0, 0, IDS_TASK_MANAGER_TAB_INCOGNITO_PREFIX}, | |
| 35 {0, 0, 0, 0, 0, IDS_TASK_MANAGER_TAB_PREFIX}}; | |
| 36 for (size_t i = 0; i < arraysize(configs); ++i) { | |
| 37 EXPECT_EQ(configs[i].expected_result, | |
| 38 GetMessagePrefixID(configs[i].is_app, | |
| 39 configs[i].is_extension, | |
| 40 configs[i].is_incognito, | |
| 41 configs[i].is_prerender, | |
| 42 configs[i].is_background)); | |
| 43 } | |
|
ncarter (slow)
2016/08/02 19:49:36
This test is potentially preservable. GetMessagePr
Avi (use Gerrit)
2016/08/02 20:06:56
Acknowledged.
| |
| 44 } | |
| 45 | |
| 46 } // namespace util | |
| 47 | |
| 48 } // namespace task_manager | |
| OLD | NEW |