| OLD | NEW |
| 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2014 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 #include "ui/app_list/views/folder_header_view.h" | 5 #include "ui/app_list/views/folder_header_view.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <memory> |
| 9 #include <string> | 10 #include <string> |
| 10 | 11 |
| 11 #include "base/command_line.h" | 12 #include "base/command_line.h" |
| 12 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
| 13 #include "base/macros.h" | 14 #include "base/macros.h" |
| 14 #include "base/memory/scoped_ptr.h" | |
| 15 #include "base/strings/utf_string_conversions.h" | 15 #include "base/strings/utf_string_conversions.h" |
| 16 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
| 17 #include "ui/app_list/app_list_constants.h" | 17 #include "ui/app_list/app_list_constants.h" |
| 18 #include "ui/app_list/app_list_folder_item.h" | 18 #include "ui/app_list/app_list_folder_item.h" |
| 19 #include "ui/app_list/app_list_item.h" | 19 #include "ui/app_list/app_list_item.h" |
| 20 #include "ui/app_list/app_list_model.h" | 20 #include "ui/app_list/app_list_model.h" |
| 21 #include "ui/app_list/test/app_list_test_model.h" | 21 #include "ui/app_list/test/app_list_test_model.h" |
| 22 #include "ui/app_list/views/folder_header_view_delegate.h" | 22 #include "ui/app_list/views/folder_header_view_delegate.h" |
| 23 #include "ui/views/test/views_test_base.h" | 23 #include "ui/views/test/views_test_base.h" |
| 24 | 24 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 } | 81 } |
| 82 | 82 |
| 83 const std::string GetFolderNameFromUI() { | 83 const std::string GetFolderNameFromUI() { |
| 84 return base::UTF16ToUTF8(folder_header_view_->GetFolderNameForTest()); | 84 return base::UTF16ToUTF8(folder_header_view_->GetFolderNameForTest()); |
| 85 } | 85 } |
| 86 | 86 |
| 87 bool CanEditFolderName() { | 87 bool CanEditFolderName() { |
| 88 return folder_header_view_->IsFolderNameEnabledForTest(); | 88 return folder_header_view_->IsFolderNameEnabledForTest(); |
| 89 } | 89 } |
| 90 | 90 |
| 91 scoped_ptr<AppListTestModel> model_; | 91 std::unique_ptr<AppListTestModel> model_; |
| 92 scoped_ptr<FolderHeaderView> folder_header_view_; | 92 std::unique_ptr<FolderHeaderView> folder_header_view_; |
| 93 scoped_ptr<TestFolderHeaderViewDelegate> delegate_; | 93 std::unique_ptr<TestFolderHeaderViewDelegate> delegate_; |
| 94 | 94 |
| 95 private: | 95 private: |
| 96 DISALLOW_COPY_AND_ASSIGN(FolderHeaderViewTest); | 96 DISALLOW_COPY_AND_ASSIGN(FolderHeaderViewTest); |
| 97 }; | 97 }; |
| 98 | 98 |
| 99 TEST_F(FolderHeaderViewTest, SetFolderName) { | 99 TEST_F(FolderHeaderViewTest, SetFolderName) { |
| 100 // Creating a folder with empty folder name. | 100 // Creating a folder with empty folder name. |
| 101 AppListFolderItem* folder_item = model_->CreateAndPopulateFolderWithApps(2); | 101 AppListFolderItem* folder_item = model_->CreateAndPopulateFolderWithApps(2); |
| 102 folder_header_view_->SetFolderItem(folder_item); | 102 folder_header_view_->SetFolderItem(folder_item); |
| 103 EXPECT_EQ("", GetFolderNameFromUI()); | 103 EXPECT_EQ("", GetFolderNameFromUI()); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 129 | 129 |
| 130 TEST_F(FolderHeaderViewTest, OemFolderNameNotEditable) { | 130 TEST_F(FolderHeaderViewTest, OemFolderNameNotEditable) { |
| 131 AppListFolderItem* folder_item = model_->CreateAndAddOemFolder("oem folder"); | 131 AppListFolderItem* folder_item = model_->CreateAndAddOemFolder("oem folder"); |
| 132 folder_header_view_->SetFolderItem(folder_item); | 132 folder_header_view_->SetFolderItem(folder_item); |
| 133 EXPECT_EQ("", GetFolderNameFromUI()); | 133 EXPECT_EQ("", GetFolderNameFromUI()); |
| 134 EXPECT_FALSE(CanEditFolderName()); | 134 EXPECT_FALSE(CanEditFolderName()); |
| 135 } | 135 } |
| 136 | 136 |
| 137 } // namespace test | 137 } // namespace test |
| 138 } // namespace app_list | 138 } // namespace app_list |
| OLD | NEW |