OLD | NEW |
| (Empty) |
1 // Copyright (c) 2011 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/automation_proxy.h" | |
6 #include "chrome/test/automation/browser_proxy.h" | |
7 #include "chrome/test/automation/extension_proxy.h" | |
8 #include "chrome/test/automation/tab_proxy.h" | |
9 #include "chrome/test/ui/ui_test.h" | |
10 #include "net/test/test_server.h" | |
11 | |
12 class InfoBarsUITest : public UITest { | |
13 public: | |
14 InfoBarsUITest() { | |
15 show_window_ = true; | |
16 } | |
17 }; | |
18 | |
19 TEST_F(InfoBarsUITest, TestInfoBarsCloseOnNewTheme) { | |
20 net::TestServer test_server(net::TestServer::TYPE_HTTP, | |
21 FilePath(FILE_PATH_LITERAL("chrome/test/data"))); | |
22 ASSERT_TRUE(test_server.Start()); | |
23 | |
24 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); | |
25 ASSERT_TRUE(browser.get()); | |
26 | |
27 scoped_refptr<TabProxy> tab_1(browser->GetActiveTab()); | |
28 ASSERT_TRUE(tab_1.get()); | |
29 EXPECT_TRUE(tab_1->NavigateToURL( | |
30 test_server.GetURL("files/simple.html"))); | |
31 scoped_refptr<ExtensionProxy> theme = automation()->InstallExtension( | |
32 test_data_directory_.AppendASCII("extensions").AppendASCII("theme.crx"), | |
33 true); | |
34 ASSERT_TRUE(theme != NULL); | |
35 EXPECT_TRUE(tab_1->WaitForInfoBarCount(1)); | |
36 | |
37 EXPECT_TRUE(browser->AppendTab( | |
38 test_server.GetURL("files/simple.html"))); | |
39 WaitUntilTabCount(2); | |
40 scoped_refptr<TabProxy> tab_2(browser->GetActiveTab()); | |
41 ASSERT_TRUE(tab_2.get()); | |
42 theme = automation()->InstallExtension( | |
43 test_data_directory_.AppendASCII("extensions").AppendASCII("theme2.crx"), | |
44 true); | |
45 ASSERT_TRUE(theme != NULL); | |
46 EXPECT_TRUE(tab_2->WaitForInfoBarCount(1)); | |
47 EXPECT_TRUE(tab_1->WaitForInfoBarCount(0)); | |
48 | |
49 EXPECT_TRUE(automation()->ResetToDefaultTheme()); | |
50 EXPECT_TRUE(tab_2->WaitForInfoBarCount(0)); | |
51 } | |
OLD | NEW |