OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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 <sstream> | 5 #include <sstream> |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/metrics/field_trial.h" | 8 #include "base/metrics/field_trial.h" |
9 #include "base/metrics/histogram_base.h" | 9 #include "base/metrics/histogram_base.h" |
10 #include "base/metrics/histogram_samples.h" | 10 #include "base/metrics/histogram_samples.h" |
(...skipping 2867 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2878 browser(), | 2878 browser(), |
2879 GURL(chrome::kChromeUINewTabURL), | 2879 GURL(chrome::kChromeUINewTabURL), |
2880 NEW_FOREGROUND_TAB, | 2880 NEW_FOREGROUND_TAB, |
2881 ui_test_utils::BROWSER_TEST_WAIT_FOR_TAB); | 2881 ui_test_utils::BROWSER_TEST_WAIT_FOR_TAB); |
2882 EXPECT_EQ(2, browser()->tab_strip_model()->count()); | 2882 EXPECT_EQ(2, browser()->tab_strip_model()->count()); |
2883 | 2883 |
2884 // Make sure new tab received the onmostvisitedchanged event once. | 2884 // Make sure new tab received the onmostvisitedchanged event once. |
2885 content::WebContents* active_tab = | 2885 content::WebContents* active_tab = |
2886 browser()->tab_strip_model()->GetActiveWebContents(); | 2886 browser()->tab_strip_model()->GetActiveWebContents(); |
2887 EXPECT_TRUE(UpdateSearchState(active_tab)); | 2887 EXPECT_TRUE(UpdateSearchState(active_tab)); |
2888 EXPECT_EQ(2, on_most_visited_change_calls_); | 2888 EXPECT_EQ(1, on_most_visited_change_calls_); |
2889 | 2889 |
2890 // Activate the previous tab. | 2890 // Activate the previous tab. |
2891 browser()->tab_strip_model()->ActivateTabAt(0, false); | 2891 browser()->tab_strip_model()->ActivateTabAt(0, false); |
2892 | 2892 |
2893 // Switch back to new tab. | 2893 // Switch back to new tab. |
2894 browser()->tab_strip_model()->ActivateTabAt(1, false); | 2894 browser()->tab_strip_model()->ActivateTabAt(1, false); |
2895 | 2895 |
2896 // Confirm that new tab got no onmostvisitedchanged event. | 2896 // Confirm that new tab got no onmostvisitedchanged event. |
2897 active_tab = browser()->tab_strip_model()->GetActiveWebContents(); | 2897 active_tab = browser()->tab_strip_model()->GetActiveWebContents(); |
2898 EXPECT_TRUE(UpdateSearchState(active_tab)); | 2898 EXPECT_TRUE(UpdateSearchState(active_tab)); |
2899 EXPECT_EQ(2, on_most_visited_change_calls_); | 2899 EXPECT_EQ(1, on_most_visited_change_calls_); |
2900 } | 2900 } |
OLD | NEW |