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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/files/file_path.h" | 6 #include "base/files/file_path.h" |
7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "chrome/browser/chrome_notification_types.h" | 10 #include "chrome/browser/chrome_notification_types.h" |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 void WebContentsDestroyed() override { close_loop_.Quit(); } | 93 void WebContentsDestroyed() override { close_loop_.Quit(); } |
94 | 94 |
95 private: | 95 private: |
96 base::RunLoop close_loop_; | 96 base::RunLoop close_loop_; |
97 | 97 |
98 DISALLOW_COPY_AND_ASSIGN(CloseObserver); | 98 DISALLOW_COPY_AND_ASSIGN(CloseObserver); |
99 }; | 99 }; |
100 | 100 |
101 class BrowserActivationObserver : public chrome::BrowserListObserver { | 101 class BrowserActivationObserver : public chrome::BrowserListObserver { |
102 public: | 102 public: |
103 explicit BrowserActivationObserver(chrome::HostDesktopType desktop_type) | 103 explicit BrowserActivationObserver(ui::HostDesktopType desktop_type) |
104 : browser_(chrome::FindLastActiveWithHostDesktopType(desktop_type)), | 104 : browser_(chrome::FindLastActiveWithHostDesktopType(desktop_type)), |
105 observed_(false) { | 105 observed_(false) { |
106 BrowserList::AddObserver(this); | 106 BrowserList::AddObserver(this); |
107 } | 107 } |
108 ~BrowserActivationObserver() override { BrowserList::RemoveObserver(this); } | 108 ~BrowserActivationObserver() override { BrowserList::RemoveObserver(this); } |
109 | 109 |
110 void WaitForActivation() { | 110 void WaitForActivation() { |
111 if (observed_) | 111 if (observed_) |
112 return; | 112 return; |
113 message_loop_runner_ = new content::MessageLoopRunner; | 113 message_loop_runner_ = new content::MessageLoopRunner; |
(...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
703 wait_for_new_tab.Wait(); | 703 wait_for_new_tab.Wait(); |
704 | 704 |
705 ASSERT_EQ(1u, chrome::GetBrowserCount(browser()->profile(), | 705 ASSERT_EQ(1u, chrome::GetBrowserCount(browser()->profile(), |
706 browser()->host_desktop_type())); | 706 browser()->host_desktop_type())); |
707 ASSERT_EQ(2, browser()->tab_strip_model()->count()); | 707 ASSERT_EQ(2, browser()->tab_strip_model()->count()); |
708 // Check that we create the background tab. | 708 // Check that we create the background tab. |
709 ASSERT_EQ(0, browser()->tab_strip_model()->active_index()); | 709 ASSERT_EQ(0, browser()->tab_strip_model()->active_index()); |
710 } | 710 } |
711 | 711 |
712 } // namespace | 712 } // namespace |
OLD | NEW |