| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/log_web_ui_url.h" | 5 #include "chrome/browser/ui/webui/log_web_ui_url.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/hash.h" | 11 #include "base/hash.h" |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/test/histogram_tester.h" | 13 #include "base/test/histogram_tester.h" |
| 14 #include "chrome/browser/ui/browser.h" | 14 #include "chrome/browser/ui/browser.h" |
| 15 #include "chrome/browser/ui/browser_commands.h" | 15 #include "chrome/browser/ui/browser_commands.h" |
| 16 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 16 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 17 #include "chrome/browser/ui/webui/md_history_ui.h" | 17 #include "chrome/browser/ui/webui/md_history_ui.h" |
| 18 #include "chrome/common/url_constants.h" | 18 #include "chrome/common/url_constants.h" |
| 19 #include "chrome/grit/generated_resources.h" | 19 #include "chrome/grit/generated_resources.h" |
| 20 #include "chrome/test/base/in_process_browser_test.h" | 20 #include "chrome/test/base/in_process_browser_test.h" |
| 21 #include "chrome/test/base/ui_test_utils.h" | 21 #include "chrome/test/base/ui_test_utils.h" |
| 22 #include "components/strings/grit/components_strings.h" | 22 #include "components/strings/grit/components_strings.h" |
| 23 #include "content/public/common/url_constants.h" | 23 #include "content/public/common/url_constants.h" |
| 24 #include "content/public/test/browser_test_utils.h" | 24 #include "content/public/test/browser_test_utils.h" |
| 25 #include "extensions/features/features.h" |
| 25 #include "testing/gmock/include/gmock/gmock.h" | 26 #include "testing/gmock/include/gmock/gmock.h" |
| 26 #include "ui/base/l10n/l10n_util.h" | 27 #include "ui/base/l10n/l10n_util.h" |
| 27 #include "url/gurl.h" | 28 #include "url/gurl.h" |
| 28 | 29 |
| 29 using base::Bucket; | 30 using base::Bucket; |
| 30 using testing::ElementsAre; | 31 using testing::ElementsAre; |
| 31 | 32 |
| 32 namespace webui { | 33 namespace webui { |
| 33 | 34 |
| 34 class LogWebUIUrlTest : public InProcessBrowserTest { | 35 class LogWebUIUrlTest : public InProcessBrowserTest { |
| (...skipping 22 matching lines...) Expand all Loading... |
| 57 ui_test_utils::NavigateToURL(browser(), history_frame_url); | 58 ui_test_utils::NavigateToURL(browser(), history_frame_url); |
| 58 | 59 |
| 59 uint32_t history_frame_url_hash = base::Hash(history_frame_url.spec()); | 60 uint32_t history_frame_url_hash = base::Hash(history_frame_url.spec()); |
| 60 EXPECT_THAT(GetSamples(), ElementsAre(Bucket(history_frame_url_hash, 1))); | 61 EXPECT_THAT(GetSamples(), ElementsAre(Bucket(history_frame_url_hash, 1))); |
| 61 | 62 |
| 62 chrome::Reload(browser(), WindowOpenDisposition::CURRENT_TAB); | 63 chrome::Reload(browser(), WindowOpenDisposition::CURRENT_TAB); |
| 63 | 64 |
| 64 EXPECT_THAT(GetSamples(), ElementsAre(Bucket(history_frame_url_hash, 2))); | 65 EXPECT_THAT(GetSamples(), ElementsAre(Bucket(history_frame_url_hash, 2))); |
| 65 } | 66 } |
| 66 | 67 |
| 67 #if defined(ENABLE_EXTENSIONS) | 68 #if BUILDFLAG(ENABLE_EXTENSIONS) |
| 68 IN_PROC_BROWSER_TEST_F(LogWebUIUrlTest, TestUberPage) { | 69 IN_PROC_BROWSER_TEST_F(LogWebUIUrlTest, TestUberPage) { |
| 69 content::WebContents* tab = | 70 content::WebContents* tab = |
| 70 browser()->tab_strip_model()->GetActiveWebContents(); | 71 browser()->tab_strip_model()->GetActiveWebContents(); |
| 71 | 72 |
| 72 base::string16 history_title = l10n_util::GetStringUTF16(IDS_HISTORY_TITLE); | 73 base::string16 history_title = l10n_util::GetStringUTF16(IDS_HISTORY_TITLE); |
| 73 | 74 |
| 74 { | 75 { |
| 75 content::TitleWatcher title_watcher(tab, history_title); | 76 content::TitleWatcher title_watcher(tab, history_title); |
| 76 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUIHistoryURL)); | 77 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUIHistoryURL)); |
| 77 ASSERT_EQ(history_title, title_watcher.WaitAndGetTitle()); | 78 ASSERT_EQ(history_title, title_watcher.WaitAndGetTitle()); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 uint32_t extensions_frame_url_hash = base::Hash(extensions_frame_url.spec()); | 117 uint32_t extensions_frame_url_hash = base::Hash(extensions_frame_url.spec()); |
| 117 | 118 |
| 118 EXPECT_THAT(GetSamples(), ElementsAre(Bucket(extensions_frame_url_hash, 1), | 119 EXPECT_THAT(GetSamples(), ElementsAre(Bucket(extensions_frame_url_hash, 1), |
| 119 Bucket(history_frame_url_hash, 2), | 120 Bucket(history_frame_url_hash, 2), |
| 120 Bucket(uber_frame_url_hash, 2), | 121 Bucket(uber_frame_url_hash, 2), |
| 121 Bucket(uber_url_hash, 2))); | 122 Bucket(uber_url_hash, 2))); |
| 122 } | 123 } |
| 123 #endif | 124 #endif |
| 124 | 125 |
| 125 } // namespace webui | 126 } // namespace webui |
| OLD | NEW |