OLD | NEW |
---|---|
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 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 | 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 <string> | 5 #include <string> |
6 | 6 |
7 #include "app/app_switches.h" | 7 #include "app/app_switches.h" |
8 #include "app/message_box_flags.h" | 8 #include "app/message_box_flags.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
56 : mock_(mock) { | 56 : mock_(mock) { |
57 channel_id_ = AutomationProxy::GenerateChannelID(); | 57 channel_id_ = AutomationProxy::GenerateChannelID(); |
58 } | 58 } |
59 | 59 |
60 AutomationProxy* CreateAutomationProxy(int execution_timeout) { | 60 AutomationProxy* CreateAutomationProxy(int execution_timeout) { |
61 *mock_ = new ExternalTabUITestMockClient(execution_timeout); | 61 *mock_ = new ExternalTabUITestMockClient(execution_timeout); |
62 (*mock_)->InitializeChannel(channel_id_, false); | 62 (*mock_)->InitializeChannel(channel_id_, false); |
63 return *mock_; | 63 return *mock_; |
64 } | 64 } |
65 | 65 |
66 void InitializeConnection(UITestBase* ui_test_base) const { | 66 void InitializeConnection(const LaunchState& state, |
67 ui_test_base->LaunchBrowserAndServer(); | 67 bool wait_for_initial_loads) { |
68 LaunchBrowserAndServer(state, wait_for_initial_loads); | |
68 } | 69 } |
69 | 70 |
70 std::string PrefixedChannelID() const { | 71 std::string PrefixedChannelID() const { |
71 return channel_id_; | 72 return channel_id_; |
72 } | 73 } |
73 | 74 |
74 private: | 75 private: |
75 ExternalTabUITestMockClient **mock_; | 76 ExternalTabUITestMockClient **mock_; |
76 std::string channel_id_; // Channel id of automation proxy. | 77 std::string channel_id_; // Channel id of automation proxy. |
77 }; | 78 }; |
(...skipping 800 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
878 CreateFunctor(loop, &TimedMessageLoopRunner::QuitAfter, ms)) | 879 CreateFunctor(loop, &TimedMessageLoopRunner::QuitAfter, ms)) |
879 | 880 |
880 template <typename T> T** ReceivePointer(scoped_ptr<T>& p) { // NOLINT | 881 template <typename T> T** ReceivePointer(scoped_ptr<T>& p) { // NOLINT |
881 return reinterpret_cast<T**>(&p); | 882 return reinterpret_cast<T**>(&p); |
882 } | 883 } |
883 | 884 |
884 template <typename T> T** ReceivePointer(scoped_refptr<T>& p) { // NOLINT | 885 template <typename T> T** ReceivePointer(scoped_refptr<T>& p) { // NOLINT |
885 return reinterpret_cast<T**>(&p); | 886 return reinterpret_cast<T**>(&p); |
886 } | 887 } |
887 | 888 |
889 ExternalTabUITest::ExternalTabUITest() : UITest(MessageLoop::TYPE_UI) { | |
890 launcher_.reset(CreateProxyLauncher()); | |
Paweł Hajdan Jr.
2011/01/08 06:45:25
Again, *why* do we need this?
| |
891 } | |
892 | |
888 // Replace the default automation proxy with our mock client. | 893 // Replace the default automation proxy with our mock client. |
889 ProxyLauncher* ExternalTabUITest::CreateProxyLauncher() { | 894 ProxyLauncher* ExternalTabUITest::CreateProxyLauncher() { |
890 return new ExternalTabUITestMockLauncher(&mock_); | 895 return new ExternalTabUITestMockLauncher(&mock_); |
891 } | 896 } |
892 | 897 |
893 // Create with specifying a url | 898 // Create with specifying a url |
894 // Flaky, http://crbug.com/32293 | 899 // Flaky, http://crbug.com/32293 |
895 TEST_F(ExternalTabUITest, FLAKY_CreateExternalTab1) { | 900 TEST_F(ExternalTabUITest, FLAKY_CreateExternalTab1) { |
896 scoped_refptr<TabProxy> tab; | 901 scoped_refptr<TabProxy> tab; |
897 TimedMessageLoopRunner loop(MessageLoop::current()); | 902 TimedMessageLoopRunner loop(MessageLoop::current()); |
(...skipping 843 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1741 int diff_pixels_count = 0; | 1746 int diff_pixels_count = 0; |
1742 for (int x = 0; x < img_size.width(); ++x) { | 1747 for (int x = 0; x < img_size.width(); ++x) { |
1743 for (int y = 0; y < img_size.height(); ++y) { | 1748 for (int y = 0; y < img_size.height(); ++y) { |
1744 if (*snapshot_bmp.getAddr32(x, y) != *reference_bmp.getAddr32(x, y)) { | 1749 if (*snapshot_bmp.getAddr32(x, y) != *reference_bmp.getAddr32(x, y)) { |
1745 ++diff_pixels_count; | 1750 ++diff_pixels_count; |
1746 } | 1751 } |
1747 } | 1752 } |
1748 } | 1753 } |
1749 ASSERT_EQ(diff_pixels_count, 0); | 1754 ASSERT_EQ(diff_pixels_count, 0); |
1750 } | 1755 } |
OLD | NEW |