Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/startup/startup_tab_provider.h" | 5 #include "chrome/browser/ui/startup/startup_tab_provider.h" |
| 6 | 6 |
| 7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "chrome/common/url_constants.h" | 8 #include "chrome/common/url_constants.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 #include "url/gurl.h" | 10 #include "url/gurl.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 60 output[0].url); | 60 output[0].url); |
| 61 EXPECT_FALSE(output[0].is_pinned); | 61 EXPECT_FALSE(output[0].is_pinned); |
| 62 } | 62 } |
| 63 | 63 |
| 64 TEST(StartupTabProviderTest, CheckResetTriggerTabPolicy_Negative) { | 64 TEST(StartupTabProviderTest, CheckResetTriggerTabPolicy_Negative) { |
| 65 StartupTabs output = | 65 StartupTabs output = |
| 66 StartupTabProviderImpl::CheckResetTriggerTabPolicy(false); | 66 StartupTabProviderImpl::CheckResetTriggerTabPolicy(false); |
| 67 | 67 |
| 68 ASSERT_TRUE(output.empty()); | 68 ASSERT_TRUE(output.empty()); |
| 69 } | 69 } |
| 70 | |
| 71 TEST(StartupTabProviderTest, CheckPreferencesTabPolicy) { | |
| 72 SessionStartupPref pref(SessionStartupPref::Type::URLS); | |
| 73 pref.urls = {GURL(base::ASCIIToUTF16("https://www.google.com"))}; | |
| 74 | |
|
Peter Kasting
2016/10/18 00:53:41
Nit: No blank here? (You don't do similar blanks
tmartino
2016/10/19 22:01:29
I did use blanks in the above tests, so I've added
| |
| 75 StartupTabs output = StartupTabProviderImpl::CheckPreferencesTabPolicy(pref); | |
| 76 | |
| 77 ASSERT_EQ(1U, output.size()); | |
| 78 EXPECT_EQ("www.google.com", output[0].url.host()); | |
| 79 } | |
| 80 | |
| 81 TEST(StartupTabProviderTest, CheckPreferencesTabPolicy_Negative) { | |
| 82 SessionStartupPref pref_default(SessionStartupPref::Type::DEFAULT); | |
| 83 pref_default.urls = | |
| 84 std::vector<GURL>({GURL(base::ASCIIToUTF16("https://www.google.com"))}); | |
|
Peter Kasting
2016/10/18 00:53:41
Nit: I think you can omit "std::vector<GURL>()" (2
tmartino
2016/10/19 22:01:29
Done
| |
| 85 StartupTabs output = | |
| 86 StartupTabProviderImpl::CheckPreferencesTabPolicy(pref_default); | |
| 87 | |
| 88 EXPECT_TRUE(output.empty()); | |
| 89 | |
| 90 SessionStartupPref pref_last(SessionStartupPref::Type::LAST); | |
| 91 pref_last.urls = | |
| 92 std::vector<GURL>({GURL(base::ASCIIToUTF16("https://www.google.com"))}); | |
| 93 output = StartupTabProviderImpl::CheckPreferencesTabPolicy(pref_last); | |
| 94 | |
| 95 EXPECT_TRUE(output.empty()); | |
| 96 } | |
| OLD | NEW |