OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <vector> | 5 #include <vector> |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
11 #include "chrome/browser/history/history.h" | 11 #include "chrome/browser/history/history.h" |
12 #include "chrome/browser/prefs/pref_service.h" | 12 #include "chrome/browser/prefs/pref_service.h" |
13 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
14 #include "chrome/browser/ui/browser.h" | 14 #include "chrome/browser/ui/browser.h" |
15 #include "chrome/common/chrome_switches.h" | 15 #include "chrome/common/chrome_switches.h" |
16 #include "chrome/common/pref_names.h" | 16 #include "chrome/common/pref_names.h" |
17 #include "chrome/common/url_constants.h" | 17 #include "chrome/common/url_constants.h" |
18 #include "chrome/test/base/in_process_browser_test.h" | 18 #include "chrome/test/base/in_process_browser_test.h" |
19 #include "chrome/test/base/ui_test_utils.h" | 19 #include "chrome/test/base/ui_test_utils.h" |
20 #include "content/public/browser/web_contents.h" | 20 #include "content/public/browser/web_contents.h" |
21 #include "content/test/test_browser_thread.h" | 21 #include "content/public/test/test_browser_thread.h" |
22 #include "googleurl/src/gurl.h" | 22 #include "googleurl/src/gurl.h" |
23 | 23 |
24 using content::BrowserThread; | 24 using content::BrowserThread; |
25 | 25 |
26 namespace { | 26 namespace { |
27 | 27 |
28 // Note: WaitableEvent is not used for synchronization between the main thread | 28 // Note: WaitableEvent is not used for synchronization between the main thread |
29 // and history backend thread because the history subsystem posts tasks back | 29 // and history backend thread because the history subsystem posts tasks back |
30 // to the main thread. Had we tried to Signal an event in such a task | 30 // to the main thread. Had we tried to Signal an event in such a task |
31 // and Wait for it on the main thread, the task would not run at all because | 31 // and Wait for it on the main thread, the task would not run at all because |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 // Mainly, this is to ensure we send a synchronous message to the renderer | 299 // Mainly, this is to ensure we send a synchronous message to the renderer |
300 // so that we're not susceptible (less susceptible?) to a race condition. | 300 // so that we're not susceptible (less susceptible?) to a race condition. |
301 // Should a race condition ever trigger, it won't result in flakiness. | 301 // Should a race condition ever trigger, it won't result in flakiness. |
302 int num = ui_test_utils::FindInPage( | 302 int num = ui_test_utils::FindInPage( |
303 browser()->GetSelectedTabContentsWrapper(), ASCIIToUTF16("<img"), true, | 303 browser()->GetSelectedTabContentsWrapper(), ASCIIToUTF16("<img"), true, |
304 true, NULL); | 304 true, NULL); |
305 EXPECT_GT(num, 0); | 305 EXPECT_GT(num, 0); |
306 EXPECT_EQ(ASCIIToUTF16("History"), | 306 EXPECT_EQ(ASCIIToUTF16("History"), |
307 browser()->GetSelectedWebContents()->GetTitle()); | 307 browser()->GetSelectedWebContents()->GetTitle()); |
308 } | 308 } |
OLD | NEW |