OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "chrome/browser/ui/webui/browsing_history_handler.h" | 5 #include "chrome/browser/ui/webui/browsing_history_handler.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 #include <memory> | 8 #include <memory> |
9 #include <set> | 9 #include <set> |
10 #include <utility> | 10 #include <utility> |
11 | 11 |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "base/memory/ptr_util.h" | 13 #include "base/memory/ptr_util.h" |
14 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
15 #include "base/test/scoped_feature_list.h" | |
16 #include "base/test/simple_test_clock.h" | 15 #include "base/test/simple_test_clock.h" |
17 #include "base/values.h" | 16 #include "base/values.h" |
18 #include "chrome/browser/history/browsing_history_service.h" | 17 #include "chrome/browser/history/browsing_history_service.h" |
19 #include "chrome/browser/history/web_history_service_factory.h" | 18 #include "chrome/browser/history/web_history_service_factory.h" |
20 #include "chrome/browser/signin/fake_profile_oauth2_token_service_builder.h" | 19 #include "chrome/browser/signin/fake_profile_oauth2_token_service_builder.h" |
21 #include "chrome/browser/signin/fake_signin_manager_builder.h" | 20 #include "chrome/browser/signin/fake_signin_manager_builder.h" |
22 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" | 21 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
23 #include "chrome/browser/signin/signin_manager_factory.h" | 22 #include "chrome/browser/signin/signin_manager_factory.h" |
24 #include "chrome/browser/sync/profile_sync_service_factory.h" | 23 #include "chrome/browser/sync/profile_sync_service_factory.h" |
25 #include "chrome/browser/sync/profile_sync_test_util.h" | 24 #include "chrome/browser/sync/profile_sync_test_util.h" |
26 #include "chrome/common/chrome_features.h" | |
27 #include "chrome/test/base/testing_profile.h" | 25 #include "chrome/test/base/testing_profile.h" |
28 #include "components/browser_sync/test_profile_sync_service.h" | 26 #include "components/browser_sync/test_profile_sync_service.h" |
29 #include "components/history/core/test/fake_web_history_service.h" | 27 #include "components/history/core/test/fake_web_history_service.h" |
30 #include "components/signin/core/browser/fake_profile_oauth2_token_service.h" | 28 #include "components/signin/core/browser/fake_profile_oauth2_token_service.h" |
31 #include "components/signin/core/browser/fake_signin_manager.h" | 29 #include "components/signin/core/browser/fake_signin_manager.h" |
32 #include "components/sync/base/model_type.h" | 30 #include "components/sync/base/model_type.h" |
33 #include "content/public/browser/browser_thread.h" | 31 #include "content/public/browser/browser_thread.h" |
34 #include "content/public/browser/web_contents.h" | 32 #include "content/public/browser/web_contents.h" |
35 #include "content/public/test/test_browser_thread_bundle.h" | 33 #include "content/public/test/test_browser_thread_bundle.h" |
36 #include "content/public/test/test_web_ui.h" | 34 #include "content/public/test/test_web_ui.h" |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 web_history_service()->ExpireHistoryBetween(std::set<GURL>(), base::Time(), | 291 web_history_service()->ExpireHistoryBetween(std::set<GURL>(), base::Time(), |
294 base::Time::Max(), callback); | 292 base::Time::Max(), callback); |
295 | 293 |
296 // No additional WebUI calls were made. | 294 // No additional WebUI calls were made. |
297 EXPECT_EQ(3U, web_ui()->call_data().size()); | 295 EXPECT_EQ(3U, web_ui()->call_data().size()); |
298 } | 296 } |
299 } | 297 } |
300 | 298 |
301 #if !defined(OS_ANDROID) | 299 #if !defined(OS_ANDROID) |
302 TEST_F(BrowsingHistoryHandlerTest, MdTruncatesTitles) { | 300 TEST_F(BrowsingHistoryHandlerTest, MdTruncatesTitles) { |
303 base::test::ScopedFeatureList scoped_feature_list; | |
304 scoped_feature_list.InitAndEnableFeature(features::kMaterialDesignHistory); | |
305 | |
306 history::URLResult long_result( | 301 history::URLResult long_result( |
307 GURL("http://looooooooooooooooooooooooooooooooooooooooooooooooooooooooooo" | 302 GURL("http://looooooooooooooooooooooooooooooooooooooooooooooooooooooooooo" |
308 "oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo" | 303 "oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo" |
309 "oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo" | 304 "oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo" |
310 "oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo" | 305 "oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo" |
311 "oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo" | 306 "oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo" |
312 "oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo" | 307 "oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo" |
313 "ngurlislong.com"), base::Time()); | 308 "ngurlislong.com"), base::Time()); |
314 ASSERT_GT(long_result.url().spec().size(), 300u); | 309 ASSERT_GT(long_result.url().spec().size(), 300u); |
315 | 310 |
(...skipping 14 matching lines...) Expand all Loading... |
330 const base::DictionaryValue* first_entry; | 325 const base::DictionaryValue* first_entry; |
331 ASSERT_TRUE(arg2->GetDictionary(0, &first_entry)); | 326 ASSERT_TRUE(arg2->GetDictionary(0, &first_entry)); |
332 | 327 |
333 base::string16 title; | 328 base::string16 title; |
334 ASSERT_TRUE(first_entry->GetString("title", &title)); | 329 ASSERT_TRUE(first_entry->GetString("title", &title)); |
335 | 330 |
336 ASSERT_EQ(0u, title.find(base::ASCIIToUTF16("http://loooo"))); | 331 ASSERT_EQ(0u, title.find(base::ASCIIToUTF16("http://loooo"))); |
337 EXPECT_EQ(300u, title.size()); | 332 EXPECT_EQ(300u, title.size()); |
338 } | 333 } |
339 #endif | 334 #endif |
OLD | NEW |