diff options
author | jeanluc@chromium.org <jeanluc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-14 01:26:57 +0000 |
---|---|---|
committer | jeanluc@chromium.org <jeanluc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-14 01:26:57 +0000 |
commit | 96d500559b422bd0446cb4e4cfff294f7cdbe1bc (patch) | |
tree | 8bd1b7e6ea20fa4bf4e5f65c31e9f4bd48cda3e4 | |
parent | 2c4d795d0277dd1e224ff2c8a5ce59ef3665fd9e (diff) | |
download | chromium_src-96d500559b422bd0446cb4e4cfff294f7cdbe1bc.zip chromium_src-96d500559b422bd0446cb4e4cfff294f7cdbe1bc.tar.gz chromium_src-96d500559b422bd0446cb4e4cfff294f7cdbe1bc.tar.bz2 |
Fix small incompatibility issues with Visual Studio 2010.
BUG=25628
TEST=Compile all.sln cleanly
Review URL: http://codereview.chromium.org/6512012
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@74778 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc | 3 | ||||
-rw-r--r-- | views/focus/focus_manager_unittest.cc | 36 |
2 files changed, 28 insertions, 11 deletions
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc b/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc index dbded16..4b738a5 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc +++ b/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc @@ -237,8 +237,7 @@ TEST_F(GLES2DecoderWithShaderTest, DrawArraysInvalidCountFails) { EXPECT_EQ(GL_NO_ERROR, GetGLError()); // Try with stride > 8 (vec2 + vec2 byte) - GLfloat f; - DoVertexAttribPointer(1, 2, GL_FLOAT, sizeof(f) * 2 + sizeof(f), 0); + DoVertexAttribPointer(1, 2, GL_FLOAT, sizeof(GLfloat) * 3, 0); EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); EXPECT_EQ(GL_NO_ERROR, GetGLError()); diff --git a/views/focus/focus_manager_unittest.cc b/views/focus/focus_manager_unittest.cc index 396a11e..5c24f5d 100644 --- a/views/focus/focus_manager_unittest.cc +++ b/views/focus/focus_manager_unittest.cc @@ -850,9 +850,18 @@ TEST_F(FocusManagerTest, FocusChangeListener) { TestFocusChangeListener listener; AddFocusChangeListener(&listener); + // Visual Studio 2010 has problems converting NULL to the null pointer for + // std::pair. See http://connect.microsoft.com/VisualStudio/feedback/details/520043/error-converting-from-null-to-a-pointer-type-in-std-pair + // It will work if we pass nullptr. +#if defined(_MSC_VER) && _MSC_VER >= 1600 + views::View* null_view = nullptr; +#else + views::View* null_view = NULL; +#endif + view1->RequestFocus(); ASSERT_EQ(1, static_cast<int>(listener.focus_changes().size())); - EXPECT_TRUE(listener.focus_changes()[0] == ViewPair(NULL, view1)); + EXPECT_TRUE(listener.focus_changes()[0] == ViewPair(null_view, view1)); listener.ClearFocusChanges(); view2->RequestFocus(); @@ -862,7 +871,7 @@ TEST_F(FocusManagerTest, FocusChangeListener) { GetFocusManager()->ClearFocus(); ASSERT_EQ(1, static_cast<int>(listener.focus_changes().size())); - EXPECT_TRUE(listener.focus_changes()[0] == ViewPair(view2, NULL)); + EXPECT_TRUE(listener.focus_changes()[0] == ViewPair(view2, null_view)); } class TestNativeButton : public NativeButton { @@ -987,19 +996,28 @@ TEST_F(FocusManagerTest, FocusStoreRestore) { message_loop()->RunAllPending(); // MessageLoopForUI::current()->Run(new AcceleratorHandler()); + // Visual Studio 2010 has problems converting NULL to the null pointer for + // std::pair. See http://connect.microsoft.com/VisualStudio/feedback/details/520043/error-converting-from-null-to-a-pointer-type-in-std-pair + // It will work if we pass nullptr. +#if defined(_MSC_VER) && _MSC_VER >= 1600 + views::View* null_view = nullptr; +#else + views::View* null_view = NULL; +#endif + // Deacivate the window, it should store its focus. SimulateDeactivateWindow(); EXPECT_EQ(NULL, GetFocusManager()->GetFocusedView()); ASSERT_EQ(2, static_cast<int>(listener.focus_changes().size())); - EXPECT_TRUE(listener.focus_changes()[0] == ViewPair(NULL, view)); - EXPECT_TRUE(listener.focus_changes()[1] == ViewPair(view, NULL)); + EXPECT_TRUE(listener.focus_changes()[0] == ViewPair(null_view, view)); + EXPECT_TRUE(listener.focus_changes()[1] == ViewPair(view, null_view)); listener.ClearFocusChanges(); // Reactivate, focus should come-back to the previously focused view. SimulateActivateWindow(); EXPECT_EQ(view, GetFocusManager()->GetFocusedView()); ASSERT_EQ(1, static_cast<int>(listener.focus_changes().size())); - EXPECT_TRUE(listener.focus_changes()[0] == ViewPair(NULL, view)); + EXPECT_TRUE(listener.focus_changes()[0] == ViewPair(null_view, view)); listener.ClearFocusChanges(); // Same test with a NativeControl. @@ -1008,13 +1026,13 @@ TEST_F(FocusManagerTest, FocusStoreRestore) { EXPECT_EQ(NULL, GetFocusManager()->GetFocusedView()); ASSERT_EQ(2, static_cast<int>(listener.focus_changes().size())); EXPECT_TRUE(listener.focus_changes()[0] == ViewPair(view, button)); - EXPECT_TRUE(listener.focus_changes()[1] == ViewPair(button, NULL)); + EXPECT_TRUE(listener.focus_changes()[1] == ViewPair(button, null_view)); listener.ClearFocusChanges(); SimulateActivateWindow(); EXPECT_EQ(button, GetFocusManager()->GetFocusedView()); ASSERT_EQ(1, static_cast<int>(listener.focus_changes().size())); - EXPECT_TRUE(listener.focus_changes()[0] == ViewPair(NULL, button)); + EXPECT_TRUE(listener.focus_changes()[0] == ViewPair(null_view, button)); listener.ClearFocusChanges(); /* @@ -1028,8 +1046,8 @@ TEST_F(FocusManagerTest, FocusStoreRestore) { EXPECT_EQ(view, GetFocusManager()->GetFocusedView()); ASSERT_EQ(2, static_cast<int>(listener.focus_changes().size())); - EXPECT_TRUE(listener.focus_changes()[0] == ViewPair(button, NULL)); - EXPECT_TRUE(listener.focus_changes()[1] == ViewPair(NULL, view)); + EXPECT_TRUE(listener.focus_changes()[0] == ViewPair(button, null_view)); + EXPECT_TRUE(listener.focus_changes()[1] == ViewPair(null_view, view)); */ } |