OLD | NEW |
| (Empty) |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "chrome/test/automation/browser_proxy.h" | |
6 #include "chrome/test/automation/extension_proxy.h" | |
7 #include "chrome/test/automation/tab_proxy.h" | |
8 #include "chrome/test/ui/ui_test.h" | |
9 #include "net/url_request/url_request_unittest.h" | |
10 | |
11 class InfoBarsUITest : public UITest { | |
12 public: | |
13 InfoBarsUITest() { | |
14 show_window_ = true; | |
15 } | |
16 }; | |
17 | |
18 TEST_F(InfoBarsUITest, TestInfoBarsCloseOnNewTheme) { | |
19 const wchar_t kDocRoot[] = L"chrome/test/data"; | |
20 scoped_refptr<HTTPTestServer> server = | |
21 HTTPTestServer::CreateServer(kDocRoot, NULL); | |
22 ASSERT_TRUE(server.get() != NULL); | |
23 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); | |
24 ASSERT_TRUE(browser.get()); | |
25 | |
26 scoped_refptr<TabProxy> tab_1(browser->GetActiveTab()); | |
27 ASSERT_TRUE(tab_1.get()); | |
28 EXPECT_TRUE(tab_1->NavigateToURL( | |
29 server->TestServerPageW(L"files/simple.html"))); | |
30 scoped_refptr<ExtensionProxy> theme = automation()->InstallExtension( | |
31 test_data_directory_.AppendASCII("extensions").AppendASCII("theme.crx"), | |
32 true); | |
33 ASSERT_TRUE(theme != NULL); | |
34 EXPECT_TRUE(tab_1->WaitForInfoBarCount(1, action_max_timeout_ms())); | |
35 | |
36 EXPECT_TRUE(browser->AppendTab( | |
37 server->TestServerPageW(L"files/simple.html"))); | |
38 WaitUntilTabCount(2); | |
39 scoped_refptr<TabProxy> tab_2(browser->GetActiveTab()); | |
40 ASSERT_TRUE(tab_2.get()); | |
41 theme = automation()->InstallExtension( | |
42 test_data_directory_.AppendASCII("extensions").AppendASCII("theme2.crx"), | |
43 true); | |
44 ASSERT_TRUE(theme != NULL); | |
45 EXPECT_TRUE(tab_2->WaitForInfoBarCount(1, action_max_timeout_ms())); | |
46 EXPECT_TRUE(tab_1->WaitForInfoBarCount(0, action_max_timeout_ms())); | |
47 | |
48 EXPECT_TRUE(automation()->ResetToDefaultTheme()); | |
49 EXPECT_TRUE(tab_2->WaitForInfoBarCount(0, action_max_timeout_ms())); | |
50 } | |
OLD | NEW |